我正在尝试使用API发送短信 它在我当地的工作正常 但它不能在远程服务器上工作,也没有给出任何错误。 如果任何1知道原因,那么请告诉我解决方案
以下代码我正在使用
`function execute($ url) {
$ch=curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output=curl_exec($ch);
curl_close($ch);
return $output;
} `
答案 0 :(得分:0)
您需要在该计算机上安装libcurl库才能使用php-curl扩展。如果您没有注释extension = php_curl.so,请查看php.ini。尝试添加此代码以确保一切正常:
if(function_exists('curl_exec')) {
echo 'curl is running';
} else {
echo 'curl is not running';
}
另外,请问您没有任何帖子字段吗?你可以用CURLOPT_POSTFIELDS做到这一点。文档为here
答案 1 :(得分:0)