我是php开发人员,我将我的网站与bluesnap集成。我想允许用户删除他们的订阅。但是我不能从curl传递url,但是"HTTP/1.1 403 Forbidden....."出现了吗?
代码
$xmlToSend = ' < subscription xmlns="http://ws.plimus.com" >< /subscription ' > ';
$url = 'https://ws.bluesnap.com/services/2/subscriptions/'.$subs_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/xml'));
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlToSend);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$result = curl_exec($ch);
$info = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
curl_close($ch);
如何解决?我可以用另一种方法来做吗或者如何用curl lib得到另一种解?
谢谢
$xmlToSend =<subscription xmlns="http://ws.plimus.com">
<subscription-id>' . $subscription_id . '</subscription-id>
<status>C</status>
<underlying-sku-id>' . $skuId . '</underlying-sku-id>
<shopper-id>' . $shopper_id . '</shopper-id>
</subscription>
;
这是我用来取消订阅的xml格式$url = 'https://ws.bluesnap.com/services/2/subscriptions/'.$subs_id;您需要修改的XML不是链接,链接是正确的。点击这里查看链接
Http错误403错误通常意味着-您没有启用访问服务所需的访问角色或IP地址-您需要联系支持以授予您正在编写的订阅的相关角色。我看到你在呼叫订阅——你需要为该呼叫启用合适的角色;如果您希望取消订阅