show data json in html table imported in link using php

0

I want to be able to show in an html table the following elements that a json is bringing me but I have no idea how to do it ...

<?php
// Initialize cURL and make the request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://cashaff.api.hasoffers.com/Apiv3/json?api_key=b7e90dad94340c93d57b4198d3a1552657f0b9b419c095703515c8c8a6ec2b72&Target=Affiliate_Report&Method=getStats&fields[]=Stat.date&fields[]=Stat.clicks&fields[]=Stat.conversions&fields[]=Stat.payout&sort[Stat.date]=asc');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// Decode the response into a PHP associative array
$response = json_decode($response, true);

// Make sure that there wasn't a problem decoding the repsonse
if(json_last_error()!==JSON_ERROR_NONE){
    throw new RuntimeException(
        'API response not well-formed (json error code: '.json_last_error().')'
    );
}

// Print out the response details or, any error messages
if(isset($response['response']['status']) && $response['response']['status']===1){
    echo 'API call successful';
    echo PHP_EOL;
    echo 'Response Data: <pre>'.print_r($response['response']['data'], true).'';
    echo PHP_EOL;
}else{
    echo 'API call failed'.(isset($response['response']['errorMessage'])?' ('.$response['response']['errorMessage'].')':'').'';
    echo PHP_EOL;
    echo 'Errors: <pre>'.print_r($response['response']['errors'], true).'';
    echo PHP_EOL;
}
?>

the data I want to bring me is generated by the link

link

Any guide to where to start =?

    
asked by Juan Ortiz 29.11.2018 в 05:14
source

0 answers