I want to post to .aspx using php in curl. The site does not require cookie.
I tried as normal curl positng and It didnt post. can anyone provide me the code?
I tried as normal curl positng and It didnt post. can anyone provide me the code?
$url = 'your url goes here';
$contents = file_get_contents();
echo $contents;
$url = 'your url goes here';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'Connection: Close'));
$contents = curl_exec($ch);
curl_close($ch);
echo $contents;
Comment