我目前正在研究 Cyberplat 的 Recharge api。
客户希望我发送:
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
我正在发送:
$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);
这是以上述格式发送请求的正确方法吗?我得到的回应bool(false)