<?php
$url = 'https://secure.platononline.com/post-balance/';
$data['account_key'] = '3KCA02HS11*******';
$data['action'] = 'GET_BALANCE';
$data['request_id'] = Date('Ym-dH-is');
$data['hash'] = md5(strtoupper($data['request_id'] . $data['account_key']));
$post_data = http_build_query($data);
$headers = [
"Content-Type: application/x-www-form-urlencoded",
"Accept: application/json",
"Content-Length: " . strlen($post_data),
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$error[] = 'CURL ErrorNo: ' . curl_errno($ch);
$error[] = 'CURL Error: ' . curl_error($ch);
$error[] = 'Url: ' . $url;
$error[] = 'Data: ' . var_export($data, true);
echo print_r($error, true);
}
curl_close($ch);
print_r($response); |