简体   繁体   中英

POST data method automatically

I want to do the following is that i am trying to post data automatically to another url

$postid = $_POST['new'];
$tt = file_get_contents("new1.php");

Make use of cURL to do this

if(isset($_POST['new']))
{
$postid = $_POST['new'];

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, 'new1.php');
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, "data=$postid");
$result = curl_exec($ch);
echo $result;
curl_close($ch);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM