作者:蔚蓝的希望_674 | 来源:互联网 | 2023-01-29 07:21
IamusingPHPwiththeAmazonPaymentswebservice.Imhavingproblemswithsomeofmyrequests.A
I am using PHP with the Amazon Payments web service. I'm having problems with some of my requests. Amazon is returning an error as it should, however the way it goes about it is giving me problems.
我正在使用PHP与Amazon Payments Web服务。我的一些要求有问题。亚马逊正在返回一个错误,但它的方式是给我带来问题。
Amazon returns XML data with a message about the error, but it also throws an HTTP 400 (or even 404 sometimes). This makes file_get_contents() throw an error right away and I have no way to get the content. I've tried using cURL also, but never got it to give me back a response.
Amazon返回带有错误消息的XML数据,但它也会抛出HTTP 400(有时甚至是404)。这使得file_get_contents()立即抛出错误,我无法获取内容。我也尝试过使用cURL,但从来没有让它给我回复。
I really need a way to get the XML returned regardless of HTTP status code. It has an important "message" element that gives me clues as to why my billing requests are failing.
无论HTTP状态代码如何,我都需要一种方法来返回XML。它有一个重要的“消息”元素,为我提供了解决我的结算请求失败的原因的线索。
Does anyone have a cURL example or otherwise that will allow me to do this? All my requests currently use file_get_contents() but I am not opposed to changing them. Everyone else seems to think cURL is the "right" way.
有没有人有cURL示例或其他允许我这样做?我的所有请求目前都使用file_get_contents(),但我并不反对更改它们。其他人似乎认为cURL是“正确”的方式。
2 个解决方案