|
Posted by Bonge Boo! on 07/01/06 12:41
On 1/7/06 12:51, in article sboca2l84durjq31cabk3j3l7q7l67ibbo@4ax.com,
"Andy Hassall" <andy@andyh.co.uk> wrote:
>> I'm trying to query a form using curl, so that I can manipulate the data it
>> returns before pushing it to the browser.
>>
>> If I just use a normal POST form it work fine. However if I use curl() then
>> the script gives an error. One things that springs to mind is the length of
>> the POST data. Its really long. So long if I try to use file_get_contents()
>> it complains.
>
> What's the error?
I think it might have been a urlencode error on my part.
>> Is there any restriction on how long the CURLOPT_POSTFIELDS can be?
>>
>> curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode($query));
>
> Shouldn't be in cURL, but you could well be hitting PHP memory limits. How
> big
> is $query?
Not that huge. About 400 characters.
A copy of a GET string below
http://www.blahbh.com/zippo/Search.ASP?WCI=AddToPortFolio%26PAGE%3D1%26DEL%3
D%26PropertyID%3D00595876%26GTYP%3D0%26ID%3D0009185%26PER%3D10%26XSLT%3D-1%2
6GID%3D580%26SQL%3D2+AND+Property.EstateAgentID+%3D+580+AND+%28Property.Inst
ructionLevel+%3C+2%29+AND+%28%28Property.Price+%2A+CurrencyConversion.Value%
29+%3C%3D+99000000+AND+%28Property.Price+%2A+CurrencyConversion.Value%29+%3E
%3D+0%29%29+AND+Property.Price+%3C%3D+300000
I think it must be a misunderstanding on my part about using curl(). If you
have a moment, and don't mind, could you take a look through this and look
for any screamers?
$query .= "&PAGE=1";
$query .= "&DEL=";
$query .= "&PropertyID=00595876";
$query .= ">YP=0";
$query .= "&ID=0000000";
$query .= "&PER=10";
$query .= "&XSLT=-1";
$query .= "&GID=400";
$query .= "&SQL=2 AND Property.EstateAgentID = 580 AND
(Property.InstructionLevel < 2) AND ((Property.Price *
CurrencyConversion.Value) <= 99000000 AND (Property.Price *
CurrencyConversion.Value) >= 0)) AND Property.Price <= 300000";
// create a new curl resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_REFERER, "http://www.blahbl.com/
zippo/Search.ASP?WCI=AddToPortFolio");
curl_setopt($ch, CURLOPT_POSTFIELDS, urlencode($dezrez_query));
// return curl as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$login_contents = curl_exec($ch);
print $login_contents;
// close curl resource
curl_close($ch);
Navigation:
[Reply to this message]
|