Php 使用json_decode and curl时出现未定义函数curl()的致命错误
您好,我想使用cURL将$\u POST发送到另一台服务器,但调用未定义的函数cURL()时发生了致命错误,我缺少什么? PS:我已经有一个php文件在同一台服务器上运行得很好,所以我确信服务器配置为使用cURLPhp 使用json_decode and curl时出现未定义函数curl()的致命错误,php,json,curl,Php,Json,Curl,您好,我想使用cURL将$\u POST发送到另一台服务器,但调用未定义的函数cURL()时发生了致命错误,我缺少什么? PS:我已经有一个php文件在同一台服务器上运行得很好,所以我确信服务器配置为使用cURL error_reporting(E_ALL); ini_set('display_errors', 1); session_start(); set_time_limit(0); $status = json_decode(curl($_POST)
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
set_time_limit(0);
$status = json_decode(curl($_POST), true); // Here is the error line
}
function curl($arra) {
{
$ip = getenv("REMOTE_ADDR");
$arra['ip'] = $ip;
$ckfile = tempnam("./tmp", "CURLCOOKIE");
$ch = curl_init("site.com/file.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $arra);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$c = curl_exec($ch);
curl_close($ch);
return $c;
}
$ip = getenv("REMOTE_ADDR");
$hostname = gethostbyaddr($ip);
$details = simplexml_load_file("www.geoplugin.net/xml.gp?ip=" . $ip . "");
$codecountry = $details->geoplugin_countryCode;
$countryname = $details->geoplugin_countryName;
$codecountry2 = strtolower($codecountry);
这是有错误的一行
$status = json_decode(curl($_POST), true);
有一个额外的花括号必须删除,也没有
Test()
方法 我看到代码中没有调用Test()
函数。请检查此代码是否与您的问题相关很抱歉,我想说的是调用curl()$status=json_decode(curl($\u POST),true);//这是错误行
function curl($arra) {
{