$url="http://182.191.78.79:92/api/ERP/Login?UserName=xxx&Password=xxx&LocationId=";
$secretKey = "sk_test_1234567";
// append the header putting the secret key and hash
$request_headers = array();
// $request_headers[] = 'Authorization: Bearer ' . $secretKey;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
// curl_setopt($ch, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$data = curl_exec($ch);
if (curl_errno($ch))
{
print "Error: " . curl_error($ch);
}
else
{
// Show me the result
$transaction = json_decode($data, TRUE);
curl_close($ch);
var_dump($transaction);
}
答案 0 :(得分:1)
您是否检查过服务器上的PHP卷曲是否可用?
function _isCurl(){
return function_exists('curl_version');
}
来源:https://stackoverflow.com/a/13433965/4934937
如果您的服务器运行php5并使用linux,您可以尝试安装php5-curl软件包,因为默认情况下它没有安装。