我想使用php curl
执行此操作 [ ~ ] $ curl -u cbb8f088775cf209035729c0eb69b9f340a3b047:X https://subs.pinpayments.com/api/v4/meresheep/subscribers.xml
到目前为止,我试过了
// Query the user to pin payments for the details...
$curl_url = "https://subs.pinpayments.com/api/v4/rigid-test/subscribers/rigids-12345.xml";
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: -u cbb8f088775cf209035729c0eb69b9f340a3b047'));
// curl_setopt($data, CURLOPT_HTTPHEADER, array(
'Authorization: Basic ' . base64_encode('cbb8f088775cf209035729c0eb69b9f340a3b047')
));
//execute post
echo $result = curl_exec($ch);
echo curl_error($ch);
die('qqqqqqqqq');
curl_close($ch);
答案 0 :(得分:0)
错误地使用的变量是错误的。 这是代码。
// Query the user to pin payments for the details...
$curl_url = "https://subs.pinpayments.com/api/v4/rigid-test/subscribers/12345.xml";
//open connection
$ch = curl_init();
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $curl_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_USERPWD,"b59d75bbdead46741b3b6875fc4b50e698392d71:test4321");
//execute post
$result = curl_exec($ch);
echo curl_error($ch);
curl_close($ch);