문제

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);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top