curl请求响应未到

时间:2019-01-09 04:49:03

标签: php curl paytm

我正在执行curl请求。在paytm文档中,他们编写了命中curl请求。他们在下面提供了这种格式:-

卷曲请求

curl -X POST https://securegw-stage.paytm.in/theia/processTransaction \
    -H 'cache-control: no-cache' \ 
    -H 'content-type: application/x-www-form-urlencoded' \ 
    -d 'REQUEST_TYPE=RENEW_SUBSCRIPTION&MID=xxxxPG01851465523919&ORDER_ID=OrderRenewTest00000000001&TXN_AMOUNT=40&CHECKSUMHASH=gf+dH5bINiwcVF8ZH8Nbmo4pcrC2lroHSl+h2n+2h7fo3nCAatHqKo2++30UFE0QD4uUuqHWMVrrcdqCKTP"WluqsB+4SlufcSJ1C1QxdQc=&SUBS_ID=1002410'

我已经搜索并在php中添加以下代码:-

<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
// following files need to be included
require_once("./lib/config_paytm.php");
require_once("./lib/encdec_paytm.php");
$data["MID"] = PAYTM_MERCHANT_MID;
$data["ORDER_ID"] = rand(10000,99999999);
$data["SUBS_ID"] = 12473;
$data["TXN_AMOUNT"] = 1;
$checkSum = getChecksumFromArray($data,PAYTM_MERCHANT_KEY);
$data['CHECKSUMHASH'] = $checkSum;
$url="https://securegw-stage.paytm.in/theia/processTransaction/";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('content-type: application/x-www-form-urlencoded'));

// execute!
$response = curl_exec($ch);

// close the connection, release resources used
curl_close($ch);
// do anpreything you want with your response
var_dump($response);
?>

输出如下:-

string(0) ""

以下文档中提到的支出除外:-

{ "TXNID":70000965271, "ORDERID":"P0000Ak42KK765456", "TXNAMOUNT":"1.00", "STATUS":"TXN_ACCEPTED", "RESPCODE":"900", "RESPMSG":"Subscription Txn accepted.", "MID":"SPOAJD86027921886450", "SUBS_ID":3001 }

0 个答案:

没有答案
相关问题