Hi Team,
I've tried searching this forum, google and various other forums and haven't found anything relative to this issue. There is a website that sells DVDs and has a search feature which is heavily coded and can't be accessed via a mobile browser so I stripped down the coding and came up with a simple HTML form. The form works fine but it loads up their search results which has a lot of irrelevant information which I want to strip down.
Is it possible to post to a remote site but return the data to a variable (so I can maniuplate)? If so how would I go about doing this? I've just found this website which is close to it but it uses javascript http://www.weberdev.com/get_example-3694.html
Thanks in advance,
Ajay
Manipulating POST data on a remote script
Moderator: General Moderators
Re: Manipulating POST data on a remote script
i would refer
to do ur posting the data. You will have options to get the data from the form that you posted and will be able to manipulate. Here is an example code
Code: Select all
curl
Code: Select all
// Set the URL that will handle the POST variables
$url ='link'; //put the action link for the search.
// Set the post variables string you want
$string='searchitem=blah&category=something';//this is just example of post string
// Initialize cURL
$ch = curl_init();
// Set the URL
curl_setopt($ch, CURLOPT_URL, $url);
// Accept cookies
curl_setopt($ch,CURLOPT_COOKIEFILE,1);
//Wait for 2 seconds while trying to connect
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
// Submit our POST values (EG: $string)
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $string);
//Return string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Execute...
$output = curl_exec($ch);
// now the whole data is got into $output variable. Do all the manipulations tou want to and display results
curl_close($ch);