doushiposong30622 2013-06-18 08:28
浏览 47
已采纳

Cyber​​plat Recharge API似乎无效

I'm currently working on Cyberplat's Recharge api.

The clients want me to send:

POST /cgi-bin/es/es_pay_check.cgi HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Content-Length: 498

inputmessage=0000037901SM000001180000011800000125%0D%0Aapi17032++
++++++++++00017033%0D%0A++++++++++++++++++++00000000%0D%0ABEGIN%0
D%0ASD%3D17031%0D%0AAP%3D17032%0D%0AOP%3D17034%0D%0ASESSION%3D4b3
4d1d400000cb80029%0D%0ANUMBER%3D8888888888%0D%0AAMOUNT%3D11%2E00%
0D%0AAMOUNT%5FALL%3D11%0D%0ACOMMENT%3D%0D%0A%0D%0AEND%0D%0ABEGIN+
SIGNATURE%0D%0AiQBRAwkBAABCiUs00dQBATG5AgDHdZ6RYHykL46QBaAvnHYaY4
p0pDjgjO4K1Iyj%0D%0AfSBSvCRpS%2F0EYO9NspuyLeANEQQkkGE%2F37gUxiPqz
AgStXjpsAHH%0D%0A%3DvSgb%0D%0AEND+SIGNATURE

I'm sending:

$ses = date("Ymdhis");
$url = "http://ru-demo.cyberplat.com/cgi-bin/DealerSertification/de_pay.cgi";
$data_string = "SD=XXXXXX&AP=XXXXXX&OP=XXXXX&SESSION=".$ses."&COMMENT=Test&NUMBER=9642065662&AMOUNT_ALL=10.0&AMOUNT=10.0";

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded','Content-Length: '.strlen($data_string)));
curl_setopt($ch, CURLOPT_POSTFIELDS, "inputmessage=0000038801SM000001270000012700000125&".$data_string);
$result = curl_exec($ch);

var_dump($result);

Was this correct way to send the request in the above format ? the response i'm getting bool(false)

  • 写回答

2条回答 默认 最新

  • dongshang4984 2013-06-18 08:31
    关注

    Don't forget to set CURLOPT_POST to true, e.g., curl_setopt($ch, CURLOPT_POST, true); Only setting the CURLOPT_POSFIELDS might not result in a POST request being performed (though I'm not sure how curl exactly handles this)

    Also, you migh want to use curl_setopt($ch, CURLOPT_VERBOSE, true); to show debug information. This is outputted to STDERR, whatever that might be on your configuration. To change it, set the CURLOPT_STDERR option.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面
  • ¥15 itunes恢复数据最后一步发生错误
  • ¥15 关于#windows#的问题:2024年5月15日的win11更新后资源管理器没有地址栏了顶部的地址栏和文件搜索都消失了
  • ¥100 H5网页如何调用微信扫一扫功能?