我正试图在examplereceiver.com/check.php上传递一些变量来自另一个网站exampledeliver.com/check.php,我不知道为什么这不起作用。 ($ usr和$ pass都是我拥有的变量)
<<this is exampledeliver code php>>
$url = 'http://examplereceiver.com/sec/check.php';
$post_dat= array($usr,$pass);
function post_data( $url, $post_dat)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_dat);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 10);
$content = curl_exec ($ch); // This returns HTML
$info = curl_getinfo($ch);
print_r($info);
curl_close ($ch);
return $content;
}
post_data($url,$post_dat);
接收examplereceiver.com/check.php也有此代码
<?php
print_r($_POST);
?>
答案 0 :(得分:-1)
最好的解决方案是编写接收数据并将其插入数据库的代码,然后从那里检索它