dongpao5658 2016-10-26 07:59
浏览 262

适用于ProductSync的API集成

Here is the method provide by Volusion support for ProductSync but the code in C# i want to implement in PHP but how to implement it i don't know.

https://support.volusion.com/hc/en-us/articles/209637767-API-Integration-ProductSync-Developer-

So anyone can help me that how to implement in PHP because i am working on PHP i have no knowledge of C#. I just copy this code in paste in my PHP it give me an error like this

Fatal error: Class 'XMLHTTP' not found in /home/tlztech/public_html/volusion/productSync.php on line 5.

And my code as under.

<?php

$api_url = "http://tebkq.mvlce.servertrust.com/net/WebService.aspx?Login=mylogin&EncryptedPassword=mypass&API_Name=Generic\\Products&SELECT_Columns=p.ProductCode,p.ProductID,p.ProductName,p.StockStatus";

$xml_http = new XMLHTTP();
$xml_http.open("POST", $api_url, false, "", "");
$xml_http.send(null);
$api_response = $xml_http.responseText;



$api_url = "http://tebkq.mvlce.servertrust.com/net/WebService.aspx?Login=mylogin&EncryptedPassword=mypass&Import=Update";
$api_request = "";
$api_request = $api_request + "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
$api_request = $api_request + "<xmldata>";
$api_request = $api_request + "   <Products>";
$api_request = $api_request + "       <ProductCode>0001</ProductCode>";
$api_request = $api_request + "       <StockStatus>5</StockStatus>";
$api_request = $api_request + "   </Products>";
$api_request = $api_request + "</xmldata>";

$xml_http = new XMLHTTP();
$xml_http.open("POST", $api_url, false, "", "");
$xml_http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
$xml_http.setRequestHeader("Content-Action", "Volusion_API");
$xml_http.send(api_request);
$xml_http = $xml_http.responseText;

$api_url = "http://tebkq.mvlce.servertrust.com/net/WebService.aspx?Login=mylogin&EncryptedPassword=mypass&API_Name=Generic\\Products&SELECT_Columns=p.ProductCode,p.ProductID,p.ProductName,p.StockStatus&WHERE_Column=p.ProductCode&WHERE_Value=0002";

$xml_http = new XMLHTTP();
$xml_http.open("POST", $api_url, false, "", "");
$xml_http.send(null);
$api_response = $xml_http.responseText;


?>

</div>
  • 写回答

2条回答 默认 最新

  • duanhaodi4809 2016-10-26 08:06
    关注

    I think it's because you need to use namespace of you're XMLHTTP class :

    $xml_http = new Your\Namespace\XMLHTTP();

    because there is no XMLHTTP class in your file. That's why it is not found

    Then if you want to use only XMLHTTP() you need to add a use at the beginning of your file:

    use <NAMESPACE>;

    If this class is from the global namespace just do it like that : $xml_http = new \XMLHTTP();

    评论

报告相同问题?

悬赏问题

  • ¥15 cgictest.cgi文件无法访问
  • ¥20 删除和修改功能无法调用
  • ¥15 kafka topic 所有分副本数修改
  • ¥15 小程序中fit格式等运动数据文件怎样实现可视化?(包含心率信息))
  • ¥15 如何利用mmdetection3d中的get_flops.py文件计算fcos3d方法的flops?
  • ¥40 串口调试助手打开串口后,keil5的代码就停止了
  • ¥15 电脑最近经常蓝屏,求大家看看哪的问题
  • ¥60 高价有偿求java辅导。工程量较大,价格你定,联系确定辅导后将采纳你的答案。希望能给出完整详细代码,并能解释回答我关于代码的疑问疑问,代码要求如下,联系我会发文档
  • ¥50 C++五子棋AI程序编写
  • ¥30 求安卓设备利用一个typeC接口,同时实现向pc一边投屏一边上传数据的解决方案。