0
我有两个PHP站点,一个API的网站(x.php)和另一个,它调用的卷曲度(y.php)API的网站PHP - 获得两个网站
的X之间,卷曲的返回值。 PHP是这样的:
if (isset($_POST['testconnection'])) {
return "ok";
}
而像这样的y.php:
$host = "https://there.is.the/x.php";
$command = array (
"testconnection" => "testconnection"
);
$ch=curl_init($host);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($command));
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,180);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
正如你所看到的例子,我想从x.php得到返回的字符串在y .php,但我在答案中得到一个空字符串:string(0)“” 我认为这将是:字符串(2)“OK” 我已经更换了回报在x.php但没有成功呼应。
很抱歉,如果这是一个小白的问题,我在卷曲很新。