You are here: Please Help With A Curl Issue « PHP Programming Language « IT news, forums, messages
Please Help With A Curl Issue

Posted by devranger on 11/29/06 15:16

Hello, I am in the process of learning PHP CURL and in doing some test
examples I am having some issues with CURL that I do not fully
understand.

I am doing a test to use CURL to post and return results from
"http://powersports.honda.com/dealer_locator/dealer_locator.asp"

However it does not appear to be returning results from the CURL post
action. What CURL appears to be doing is finding the page
"http://powersports.honda.com/dealer_locator/dealer_locator.asp",
becasue I can wirte any portion of the page to a file with fwrite after
curl_exec($ch);, but I can not see the redirected page after a post is
done to retrun the results via fwrite. I have CURLOPT_FOLLOWLOCATION,
true so it should be finding the redirected pages.

The same code works fine if I just change $data to zip= for
"http://www.suzukicycles.com/DealerLocator/".

Can some help on why the below code may not be working on
"http://powersports.honda.com/dealer_locator/dealer_locator.asp" and
what I can do to get it working or how to go about debugging this so
that I can figure out why it is not working?

You can see the one that is working here:
// this is for suzuki
http://www.subdomain.tetrahost.net/test/test4.php

Your help is much appreciated. This one is driving me crazy.

Thank you!
devranger

<?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 ($Contents);

echo 'done';
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация