You are here: Re: Having Trouble With CURL Function, Please Help « PHP Programming Language « IT news, forums, messages
Re: Having Trouble With CURL Function, Please Help

Posted by devranger on 12/25/06 19:38

I have been reading up on what you suggested Rik and testing different
options but I am still not successful in getting the results returned.
I have set the curl_setopt($ch, CURLOPT_REFERER, $url); and also set up
to curl sessions, one to capture the cookie and the other to post with
the cookie (see below): I really feel it may have something to do
with the long input names and : in the input name of my $data variable,
but Jerry said the data vaiable was correct.

Does anyone have any other suggestion on how I could get this working?
Your help is much appreciated, I feel I have learned so much so far.

Thank you!!!!



$data="MasterTemplate:_PageTemplate:cphCenterContent:CenterContent:fcDropDownList=ATVs&MasterTemplate:_PageTemplate:cphCenterContent:CenterContent:zipTextBox=77090";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURL_ERROR, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
$result = curl_exec ($ch);
curl_close ($ch);

// 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_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURL_ERROR, 1);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_TIMEOUT, 600);

// grab URL, and return output

$Contents = curl_exec($ch);

 

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

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