Dipok Chakraborty
Dipok Chakraborty

Reputation: 32

How i receive curl post data in php

When i close the curl then it will give me warning and how i will receive data which i send using curl.here is my code.variable $data contain my URL where i want to send my data.any one can help me?

<?php
$ch=curl_init($data);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, "url=http://mydomain.com/newc/index.php");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE);
$returndata=curl_exec($ch);
echo $returndata;
curl_close($returndata);
?>

Upvotes: 0

Views: 4152

Answers (1)

Shub
Shub

Reputation: 2694

Try This:

$datatopost = array("url" => "http://mydomain.com/newc/index.php" );
$ch= curl_init($data);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $datatopost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$returndata = curl_exec($ch);
echo $returndata;
curl_close($ch);

Upvotes: 1

Related Questions