w1zzerd Posted October 9, 2014 Share Posted October 9, 2014 I have been given a task, and I gotta say it is kicking my butt. Here is what I have to do. 1. Have user fill out and submit a form. 2. Data gets sent to: http://www.ffiec.gov/geocode/Default.aspx 3. Data is set as values for input fields in the sites form. 4. Form executes. 5. Retrieve result data. 6. Display data back to my site. I have no idea how to do this. Usually when I have done something like this I use an API. Hope my question is clear. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
trq Posted October 9, 2014 Share Posted October 9, 2014 This sort of thing is done using the curl extension, or better still a wrapper like Guzzle. Where exactly are you stuck? Quote Link to comment Share on other sites More sharing options...
w1zzerd Posted October 9, 2014 Author Share Posted October 9, 2014 I am mainly stuck on how I am going to send the parameters from my form to the form fields on the external site and then submit the form to get the response data after form submission so I can then display the results in a result page on my local site. I was able to use curl to get the site and echo things like the title and different tags but that is as far as I got. Quote Link to comment Share on other sites More sharing options...
w1zzerd Posted October 9, 2014 Author Share Posted October 9, 2014 I looked at the source code on the site I am trying to scrape, I found the form once submitted calls a Default.aspx as the action file in the form. I can get the input names for each input field. Is there a way I can go to the Default.aspx file and set the appropriate post data. For example: if the Default.aspx takes POST data with the names of "city" and "state" Can I set the post data like this: $_POST['city']="San Diego"; $_POST['state']="CA"; then send that post data to the Default.aspx when I call the www.site.com/Default.aspx Is that possible? Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted October 9, 2014 Share Posted October 9, 2014 As trq suggested, you can use curl. Check out this little example, it's super easy: http://davidwalsh.name/curl-post Quote Link to comment Share on other sites More sharing options...
w1zzerd Posted October 22, 2014 Author Share Posted October 22, 2014 This ended up being a complete mess of a project. After I finally figured everything out, I was told this was no longer needed and that I was going to be given a spreadsheet to convert into a database and then create the app using two API's and then grab the results from the DB. I had no problem going this route but I spent a long while figuring out how to crawl a site. Thanks for the help guys. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.