curl-and-php
Curl PHP weirdness, apache seg fault.
Date: Sat, 18 Sep 2004 15:10:35 +0100
Afternoon all (Just relised that there was this list so sorry for the double
posting on -users),
I have the following script in PHP using curl:
$url="www.a-url.com"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://$url");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_COOKIEFILE,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $poststring);
$ret=curl_exec($ch);
$error = curl_error($ch);
I can echo out $ret and it pulls out the page correctly at that point then i
continue:
$url2 = "a url from $ret";
//Some processing to work out my new post string
curl_setopt($ch, CURLOPT_URL,"http://$url2");
curl_setopt($ch, CURLOPT_POSTFIELDS, $poststring);
$ret2=curl_exec($ch);
$error2 = curl_error($ch);
Again at this point I echo out $ret2 and all is well.
Now I find a url within $ret2, I can confirm this url is fine as I have
replicated the proccess by hand.
When I add this to the bottom of the script the script refuses to run and apache
gives out a (11) segmentation fault.
curl_setopt($ch, CURLOPT_URL,"http://$url3");
$ret3=curl_exec($ch);
$error3 = curl_error($ch);
echo $ret3;
The only think I can think of is that its a larger (but not that big really) URL
and its a GET process I need to run not a POST.
The url is: (with the real host not included of course)
www.a-url.com/home/search/results.asp?list=false&fid=0&ord=undefined&bid=1&dbt=1&p=2&asv=undefined&cur=GBP&thu=undefined&vto=undefined&nba=undefined&vtourlist=false
Any ideas, as you can probably tell I am new to CURL and this is my first test
script.
Cheers
John Wards
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Received on 2004-09-18