Json to Array with the API's
Posted: Sun Nov 13, 2016 9:06 pm
Pri, thankfully, released an API for us who want to code a script to monitor or record different information from the site. These are structured in the form of a JSON, which every programming language has a library for. That being said, i decided to approach this with PHP, using curl. After some time, i have a base code together for anyone to use, just replace the with your cookie:
To find your cookie, in chrome at least, right-click on any of the pages, say cards.renmx.com for example.
Click inspect, in the box that pops up click application on the top bar, expand the cookies menu, and click cards.renmx.com
Then you can replace with:
keep in mind the something_VALUES are the fields underneath the values bar, corresponding to the proper sections.
Hope this helps!
Code: Select all
//cookie
Code: Select all
<?php
// CURL function for processing all the services simultaneously
function CurlURL($Curl_This_URL) {
$ch = curl_init("$Curl_This_URL");
$options = array(
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 5,
CURLOPT_AUTOREFERER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => 0 ,
CURLOPT_SSL_VERIFYHOST => 0 ,
CURLOPT_HTTPHEADER => array(//cookie)
);
curl_setopt_array($ch, $options);
$curl_page_result = curl_exec($ch);
curl_close($ch);
return $curl_page_result;
}
$Page_Result = CurlURL("http://shop.renmx.com/json.php");
// curl_setopt($url, CURLOPT_HTTPHEADER, array(//cookie));
$Page_Json_Decode = json_decode($Page_Result);
//print_r($Page_Json_Decode);
var_dump($Page_Json_Decode);
?>
Click inspect, in the box that pops up click application on the top bar, expand the cookies menu, and click cards.renmx.com
Then you can replace
Code: Select all
//cookie
Code: Select all
"Content-Type : application/x-www-form-urlencoded", "Cookie: __cfduid_VALUE; ULaccount=ULaccount_VALUE; ULkey=ULkey_VALUE; PHPSESSID=PHPSESSID_VALUE;"
Hope this helps!