I am trying to add a request header that is generated when a user searches an airport code in the form using weather.com. I have successfully curled the first page, but i am not sure how to implement the next step on using the GET form data.
The query string is search?where=phx&start_with=1&search_loc_type=9&x=5&y=13. The phx is the airport code. This changes everytime someone searches a different airport code
I am trying to figure out how to add this query string, for example, search?where="Airport_variable".&start_with=1&search_loc_type=9&x=5&y=13.
So when a person types a airport code its fetched by the weather.com server and added to the search query and displaying the search results based on that query. What is confusing me is GET request using curl. The current code will parse the airport weather page, but i can't figure out how to add the missing object.
Can someone please help me?
Here is what I have so far:
<?php $URL = "http://www.weather.com/activities/travel/businesstraveler/"; $chwnd = curl_init(); curl_setopt($chwnd, CURLOPT_URL,$URL); curl_setopt($chwnd, CURLOPT_VERBOSE, 1); curl_setopt($chwnd, CURLOPT_POST, 1); curl_setopt($chwnd, CURLOPT_POSTFIELDS, TRUE); $returned = curl_exec($chwnd); curl_close ($chwnd); // /search?where=bhm&start_with=1&search_loc_type=9&x=0&y=0 ?>
I am not sure what to do next so i can make a variable that stores that changing airport code on the end of the query string.
If i use the search box here is teh following query string http://www.weather.com/outlook/travel/businesstraveler/search?where=phx&start_with=1&search_loc_type=9&x=0&y=0
If i use the drop down its this: http://www.weather.com/outlook/travel/businesstraveler/airportprofile/ANC Where the "ANC" changes.
My over all outcome is to display the weather after the drop down or search is request by the get form data.