我写了这段代码:
$data = array(
'user' => '*****',
'password' => '****',
'terminal' => '******',
'GoodURL' => '********',
'Total' => *******,
);
$jsonData = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://gateway20.pelecard.biz/PaymentGW/init");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json;','Content-Length: ' . strlen($jsonData)));
if ($call == 'pay') {
$result = curl_exec($ch);
$serverData = json_decode($result, true);
echo $serverData['URL'];
}
数组中的参数很好data
,但我总是得到result = false
. 谁能告诉我我做错了什么?
谢谢