lostnucleus Posted February 3, 2009 Share Posted February 3, 2009 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. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 3, 2009 Share Posted February 3, 2009 I suggest you try posting your actual code. It's a bit difficult to help you otherwise. Quote Link to comment Share on other sites More sharing options...
lostnucleus Posted February 3, 2009 Author Share Posted February 3, 2009 <?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. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 3, 2009 Share Posted February 3, 2009 Ok, so what actually happens when you increase the length of the variable? Do you get an error? Have you tried checking the value of curl_error? Can you make requests with data this long manually? Quote Link to comment Share on other sites More sharing options...
lostnucleus Posted February 3, 2009 Author Share Posted February 3, 2009 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....... Quote Link to comment Share on other sites More sharing options...
printf Posted February 3, 2009 Share Posted February 3, 2009 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! Quote Link to comment Share on other sites More sharing options...
lostnucleus Posted February 3, 2009 Author Share Posted February 3, 2009 superb............exact solution with accurate info..........thanks a milllion printf ...... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.