PG Transaction Orders History
cURL HTTP PHP_Http-Request2 PHP_cURL Javascript_Jquery Javascript_XHR
Copy curl --location --request POST 'http://pgtest.payon.com.kh/pg/orders' \
--data-raw '{
"fromDate":"01112018",
"toDate":"24112020",
"index":1,
"limit":5,
"trt":"10",
"merchantId":"C0000143",
"termId":"CT03000003"
}'
Copy POST /pg/orders HTTP / 1.1
Host : pgtest.payon.com.kh
{
"fromDate" : "01112018" ,
"toDate" : "24112020" ,
"index" : 1 ,
"limit" : 5 ,
"trt" : "10" ,
"merchantId" : "C0000143" ,
"termId" : "CT03000003"
}
Copy <? php
require_once 'HTTP/Request2.php' ;
$request = new HTTP_Request2 ();
$request -> setUrl ( 'http://pgtest.payon.com.kh/pg/orders' ) ;
$request -> setMethod ( HTTP_Request2 :: METHOD_POST ) ;
$request -> setConfig ( array (
'follow_redirects' => TRUE
) ) ;
$request -> setHeader ( array (
'Cookie' => 'SESSION=2e99ea42-84d2-4853-8c24-d5e541673468'
) ) ;
$request->setBody('{\n "fromDate":"01112018",\n "toDate":"24112020",\n "index":1,\n "limit":5,\n "trt":"10",\n "merchantId":"C0000143",\n "termId":"CT03000003"\n}');
try {
$response = $request -> send () ;
if ($response -> getStatus () == 200 ) {
echo $response -> getBody () ;
}
else {
echo 'Unexpected HTTP status: ' . $response -> getStatus () . ' ' .
$response -> getReasonPhrase () ;
}
}
catch ( HTTP_Request2_Exception $e) {
echo 'Error: ' . $e -> getMessage () ;
}
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => "http://pgtest.payon.com.kh/pg/orders" ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => "" ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => "POST" ,
CURLOPT_POSTFIELDS =>"{\n \"fromDate\":\"01112018\",\n \"toDate\":\"24112020\",\n \"index\":1,\n \"limit\":5,\n \"trt\":\"10\",\n \"merchantId\":\"C0000143\",\n \"termId\":\"CT03000003\"\n}",
CURLOPT_HTTPHEADER => array(
"Cookie: SESSION=2e99ea42-84d2-4853-8c24-d5e541673468"
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy var settings = {
"url" : "http://pgtest.payon.com.kh/pg/orders" ,
"method" : "POST" ,
"timeout" : 0 ,
"headers" : {
"Cookie" : "SESSION=2e99ea42-84d2-4853-8c24-d5e541673468"
} ,
"data": "{\n \"fromDate\":\"01112018\",\n \"toDate\":\"24112020\",\n \"index\":1,\n \"limit\":5,\n \"trt\":\"10\",\n \"merchantId\":\"C0000143\",\n \"termId\":\"CT03000003\"\n}",
};
$ .ajax (settings) .done ( function (response) {
console .log (response);
});
Copy var data = "{\n \"fromDate\":\"01112018\",\n \"toDate\":\"24112020\",\n \"index\":1,\n \"limit\":5,\n \"trt\":\"10\",\n \"merchantId\":\"C0000143\",\n \"termId\":\"CT03000003\"\n}";
var xhr = new XMLHttpRequest ();
xhr .withCredentials = true ;
xhr .addEventListener ( "readystatechange" , function () {
if ( this .readyState === 4 ) {
console .log ( this .responseText);
}
});
xhr .open ( "POST" , "http://pgtest.payon.com.kh/pg/orders" );
xhr .setRequestHeader ( "Cookie" , "SESSION=2e99ea42-84d2-4853-8c24-d5e541673468" );
xhr .send (data);