Php Curl post data help needed.

Status
Not open for further replies.

hq320

Active Member
142
2010
31
10
[Solved] Php Curl post data help needed.

Hello, i got this code.
Its working good as long i post small data.
If i try to post larger text it will post only part of it.
Can someone help me with curl settings.

Code:
PHP:
$post_data['title'] = $game;
$post_data['name'] = 'test';
$post_data['comment']  = $post_body;
//traverse array and prepare data for posting (key1=value1)
foreach ( $post_data as $key => $value) {
    $post_items[] = $key . '=' . $value;
}
 
//create the final string to be posted using implode()
$post_string = implode ('&', $post_items);
 
//create cURL connection
$curl_connection =
  curl_init('http://www.1.com/form_post_test.php');
 
//set options
curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 190);
curl_setopt($curl_connection, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt ($curl_connection, CURLOPT_HTTPHEADER, array(
        'Content-type: application/x-www-form-urlencoded',
        'Accept: text/html',
        'Expect: ',
    ) );
    
curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);


//set data to be posted
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
 
//perform our request
$result = curl_exec($curl_connection);
 
//show information regarding the request
print_r(curl_getinfo($curl_connection));
echo curl_errno($curl_connection) . '-' .
                curl_error($curl_connection);
curl_error(); 
//close the connection
curl_close($curl_connection);
 
Last edited:
4 comments
I think there is no limit at server side.
I am trying to post text:
Game:

L Tsurenko - A Pavlyuchenkova<br />

Pick: </B> 2 (-1.5 )

Thi s two players h ave played <br />
Tsurenko played qualification here and she could be tired.Hard is not her favorite surface(35/31 in career).She is for 60 places lower ranked than Pavlyuchenkova.<br />
Anastasia has nhich they are favorites<br />
and this what only come up:

Game:
L Tsurenko - A Pavlyuchenkova
 
Status
Not open for further replies.
Back
Top