我正在创建一个带有 Commission Junction 链接的网站。现在我需要处理佣金报告以分配佣金。我计划使用每日出版商佣金服务,因为它提供了在请求中包含日期的规定。现在我无法通过 CJ 链接进行购买,因此我使用 CJ 网站本身。我对这些 wbservices 很陌生,因此对此有一些疑问。
-
实际响应将与给出的响应完全相同。我的意思是它会包含
事情或者它只是从 ns1 开始。???
-
我已将响应分配给变量 $result 并给出
$result_xml=simplexml_load_string($result);
但它显示 ns1 未在命名空间中定义的错误。然后我将 的东西放到了顶部。现在错误已经消失了。但 result_xml 变量为空。
如果有人以前做过,请帮助我。或者请给我推荐一些好的教程,以便我可以学习并做到这一点。如果有人可以提供完整的示例响应,那将非常有帮助,这样我就可以用它检查代码。
提前致谢。
I am creating a website with the Commission Junction links,. Now I need to process the commission reports for dividing the commissions. I am planning to use Daily Publisher Commission Service as it provides a provision for including the date in the request. Now I am not able to do a purchase through the CJ link and so I am using a sample query that has given in CJ site itself. I am new to these wbservices and so have some doubts here.
-
The actual respone will be exactly same as the one given. I mean will it includes the <soapenv:Envelope
things or it is begin with just the ns1.???
-
I have assigned the response to a variable $result and give
$result_xml=simplexml_load_string($result);
but it is showing the error that ns1 is not defined in namespace. Then I have given the <soapenv:Envelope
things to the top. Now the error has gone. But the result_xml variable is blank .
Please help me if someone has done it before. or please suggest me some good tutorials so that I can learn and do it. It will be much helpful if someone can give the complete sample response and so I can check the code with it.
Thanks in Advance.
发布评论
评论(1)
对 SOAP 请求的 XML 响应类似于:
您可能在将 xml 响应解析为 SimpleXml 对象时遇到问题,因为 SimpleXML 不喜欢标签和属性名称中的冒号 (:) SOAP 和SimpleXML。另请检查此处 SimpleXML &命名空间
您的 SOAP 请求应该已经是一个对象,因此我不确定您为什么尝试使用 SimpleXML 解析它。如果您需要 XML 形式的响应,那么您始终可以使用 序列化器。
以我自己的脚本为例,我使用这样的内容:
//code here
$cj_devkey = "这里是 CJ 密钥";
使用 print_r($object) 的示例响应将返回:
如果您想遍历对象元素,您可以使用以下内容:
或使用以下内容循环遍历每个佣金付款:
An XML response to a SOAP request will be something like:
You maybe having issues parse the xml response into a SimpleXml Object because SimpleXML doesn't like colons (:) in the tag and attribute names SOAP & SimpleXML. Also check here SimpleXML & Namespaces
Your SOAP request should already be an object so I am uncertain as to why you are trying to parse it using SimpleXML. If you need the response as XML then you could always use a serializer.
In my own script as an example I use something like this:
//code here
$cj_devkey = "CJ KEY HERE";
A sample response using print_r($object) will return :
If you want to traverse the object elements you can use stuff like:
or loop through each commission payment with stuff like: