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.

 

Link to comment
Share on other sites

<?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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.