Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

function getData($num=0){ $token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NjgsInJvbG..

Decoded Output download

<?  function getData($num=0){ 
$token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NjgsInJvbGVzIjoiU1VQRVJfQURNSU4iLCJzdGF0dXMiOiJWRVJJRklFRCIsImVtYWlsIjoic2lzaUBnbWFpbC5jb20iLCJwaG9uZSI6IjA1NTU1MjI1NTUiLCJnb3ZfaWQiOm51bGwsImlhdCI6MTczNDg1NzY5NCwiZXhwIjoxNzM1MTE2ODk0fQ.3hcaYmgHHpeWTXlAX6WgodDoWWs0Mzd23ZHamGjUDlA'; 
$url="https://api.medmart.health/drugs?page_number=".$num."&sort=name"; 
 
//  Initiate curl 
$ch = curl_init(); 
// Will return the response, if false it print the response 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
 
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer ' . $token)); 
// Set the url 
curl_setopt($ch, CURLOPT_URL,$url); 
// Execute 
$result=curl_exec($ch); 
// Closing 
curl_close($ch); 
$decodedData =  json_decode($result, true); 
//echo "<pre>"; 
return $decodedData['data']['drugs']; 
} 
 
 
$wrapAllData=array(); 
 
$fp = fopen('drugs.csv', 'w'); 
for($i=0;$i<10;$i++){ 
    $datas=getData($i); 
    foreach($datas as $key=>$data){ 
      
       
        if($key==0){ 
            fputcsv($fp, array("Picture","Name","Price","Category"));  
 
            fputcsv($fp, array($data['image_url'],$data['name'],$data['price'],$data['category']['name']));  
        } else{ 
            fputcsv($fp, array($data['image_url'],$data['name'],$data['price'],$data['category']['name']));    
        } 
         
        //fputcsv($fp, $data);  
    } 
} 
 ?>

Did this file decode correctly?

Original Code

function getData($num=0){
$token='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NjgsInJvbGVzIjoiU1VQRVJfQURNSU4iLCJzdGF0dXMiOiJWRVJJRklFRCIsImVtYWlsIjoic2lzaUBnbWFpbC5jb20iLCJwaG9uZSI6IjA1NTU1MjI1NTUiLCJnb3ZfaWQiOm51bGwsImlhdCI6MTczNDg1NzY5NCwiZXhwIjoxNzM1MTE2ODk0fQ.3hcaYmgHHpeWTXlAX6WgodDoWWs0Mzd23ZHamGjUDlA';
$url="https://api.medmart.health/drugs?page_number=".$num."&sort=name";

//  Initiate curl
$ch = curl_init();
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer ' . $token));
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$decodedData =  json_decode($result, true);
//echo "<pre>";
return $decodedData['data']['drugs'];
}


$wrapAllData=array();

$fp = fopen('drugs.csv', 'w');
for($i=0;$i<10;$i++){
    $datas=getData($i);
    foreach($datas as $key=>$data){
     
      
        if($key==0){
            fputcsv($fp, array("Picture","Name","Price","Category")); 

            fputcsv($fp, array($data['image_url'],$data['name'],$data['price'],$data['category']['name'])); 
        } else{
            fputcsv($fp, array($data['image_url'],$data['name'],$data['price'],$data['category']['name']));   
        }
        
        //fputcsv($fp, $data); 
    }
}

Function Calls

fopen 1
getData 1
curl_init 1

Variables

$i 0
$fp True
$num 0
$url https://api.medmart.health/drugs?page_number=0&sort=name
$token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NjgsInJvbGVzIjo..
$wrapAllData []

Stats

MD5 7f4f1c94e881551dad6da6102ad3ecc7
Eval Count 0
Decode Time 54 ms