【发布时间】:2016-02-23 21:13:20
【问题描述】:
谁能帮我在php中做一个curl函数来访问这个api服务
curl -v -u :xxxxx-2573-440e-8adc-cc23bb019db9
https://api.paylike.io/transactions/56ccbfe1b31be55xxxxx
目前我有这个,但我收到 403 错误
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, "https://api.paylike.io/transactions/556ccbfe1b31be55xxxxx");
curl_setopt($ch, CURLOPT_USERPWD, 'xxxxx-2573-440e-8adc-cc23bb019db9');
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:application/json", "Cache-Control:no-cache"));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
谢谢
【问题讨论】: