【发布时间】:2018-01-09 23:10:03
【问题描述】:
$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);
}
【问题讨论】:
-
请格式化您的代码并提供详细说明。
-
我最喜欢的故障排除问题:尝试时会发生什么?您是否收到任何错误消息?
-
不工作怎么办?错误信息?结果错误?电脑会不会死机?请阅读:How to create a Minimal, Complete, and Verifiable example 和 How do I ask a good question?
-
开启报错并执行脚本。然后,如果有任何异常,您可能会看到 PHP 错误。有时这可能是由您的防火墙引起的问题。
-
错误:无法连接到 182.191.78.79 端口 92:连接被拒绝
标签: php codeigniter