I am new to using curl. I would like you to help me creating a code for this url in curl.
I want to create a php file which has to get the similar data and post the data to above url using curl. Thanks for your help once again.
<?php
$url = "http://example.com/example/example.aspx";
$fields = array(
'post1' => 'xxx',
'post2' => 'xxx',
'post3' => 'xxx',
'post4' => 'xxx',
'post5' => 'xxx',
'post6' => 'xxx',
'post7' => 'xxx'
);
foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string, '&');
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
//execute post
$result = curl_exec($ch);
//close connection
curl_close($ch);
?>