Hello, I am trying to use CURL to post and return results with the below curl function from
http://powersports.honda.com/dealer_locator/dealer_locator.asp
However it does not appear to be returning results from the post. It works fine if I use the same code changing $data to zip= for this url
http://www.suzukicycles.com/DealerLocator/
.
Can some help on why it is not working on
http://powersports.honda.com/dealer_locator/dealer_locator.asp
?
You can see each in action here:
//this is for honda
http://www.subdomain.tetrahost.net/test/test5.php
// this is for suzuki
http://www.subdomain.tetrahost.net/test/test4.php
<?php
$data=array("ZipCode=90277");
$url="http://powersports.honda.com/dealer_locator/dealer_locator.asp";
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Test0.1');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// grab URL, and return output
$Contents = curl_exec($ch);
// close curl resource, and free up system resources
print_r ($_POST);
print_r ($Contents);
echo 'done';
?>