duangao8359 2015-08-08 08:54
浏览 44

使用PHP进行Ingram微集成

I am trying to post XML request to ingram micro url the code shown below

 <?php

$url = "https://newport.ingrammicro.com/mustang";

$post_string = '<BaseRateRequest>
<Version1.0></Version1.0>
<TransactionHeader>
  <CountryCode>FT</CountryCode> 
  <LoginID>username</LoginID> 
  <Password>password</Password> 
  <TransactionID>TESTAIC12356</TransactionID> 
  </TransactionHeader>
<BaseRateInformation>
  <BranchOrderNumber>4066000</BranchOrderNumber> 
  <PostalCode>L5R1V4</PostalCode> 
  <Suffix /> 
  </BaseRateInformation>
  </BaseRateRequest>';


$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "XML=".$post_string);

$data = curl_exec($ch); 
print_r($data);    
?>

But, I don't know how to request and response in XML. I am getting the error: Invalid Inbound XML Document.

What does that means and how to solve it ?

  • 写回答

1条回答 默认 最新

  • drxkx6149 2016-08-01 19:51
    关注

    you have to remove "XML="

    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
    

    and probably also add the XML header:

    <?xml version="1.0" encoding="UTF-8"?>
    <BaseRateRequest>
    ...
    </BaseRateRequest>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来