Jump to content

Long string passed to CURL_POSTFIELDS not getting posted??


lostnucleus

Recommended Posts

curl_setopt($s,CURLOPT_POSTFIELDS,$mypost);

 

$mypost=  = "var1="1"&var2=ddddddddddddddddddddddddddddddddjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjidddddddddddddddddddddddddddddddddddddddddddddddddddddddnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnssssssssssssssssssssssssssssssssssssssssssssslllllllllllllllllllllllllllllllllllllllllllllllllllkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppppppppppppppppppppppppppppppppppppppppppppppppppppppppzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmfffffffffffffffffffffffffffffffffffffffffffoooooooooooooooooooooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddssss333333333333222222222222222222222222222222222222222222222299999999999999999999999999999999999ddddddddddddddddddddddddddddddddddds0000000000000000000000000000llllllllllllllllllllllllllllllllllllllllllllllzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzmmmmmmmmmmmmmmccccccccccccccccccccccccccccc";

 

when i make var2 small(reduce its lenght) , it works fine otherwise its not getting posted .......plz help i hv wasted 24hrs already on this....

thanks in advance.

 

<?php
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"http://www.site.com/form/");
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"var1=these&var2=are&var3=my&var4=variables");

$data=curl_exec($ch);
curl_close($ch);
?> 

 

All i want to know is there any limit on lenght of each variable used abv (var1,var2,var3,var4) , since when i used long variables (var1=ddddddddddddddddddd.....ddddd..........dddddddddddddddddddddddddddddddsssssssssssss);

they do not get posted plz try how to overcome this problem.......thanks.

getting no error but just HTTP/1.1 417 Expectation Failed ,

Is there any limit of letters we can use in "var1" as in example above...?

since with less letters used in "var1" everthing works well.......

 

Thanks once again.......

It lib cURL faults, it just another thing that cURL doesn't do right. Anytime you send data greater than > 1024 kbytes a server asks for a 100-continue handshake, cURL doesn't support the proper response command so the server kills the request. cURL sends the response command before it's even requested, which is why the server reject the request.

 

A work around...

 

<?php

$ch = curl_init ();

curl_setopt ( $ch, CURLOPT_URL, 'http://www.site.com/form/' );

/* make cURL wait for the proper command */

curl_setopt ( $ch, CURLOPT_HTTPHEADER, array ( 'Expect:' ) );

curl_setopt ( $ch, CURLOPT_POST, true );

curl_setopt ( $ch, CURLOPT_POSTFIELDS, "var1=these&var2=are&var3=my&var4=variables" );

$data=curl_exec ( $ch );

curl_close ( $ch );

?>

 

 

The RFC 2616 states

 

Because of the presence of older implementations, the protocol allows ambiguous situations in which a client may send "Expect: 100- continue" without receiving either a 417 (Expectation Failed) status or a 100 (Continue) status but the http/1.1 client must be able to deal with 417 for a request with "Expect: 100-continue" so when the server does not support the command the client must avoid using said command... Which libcURL does not do!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.