Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Can someone help me to understand how to do this API thing? The problem is, it doesn't display an output. Then, I have learned that the GET is not really needed(can be there or not) to be part of the code, but in this case, when I am deleting the GET I am getting an error output. This:
HTML
<a href="https://support.dudamobile.com/API/REST-Resources/Analytics">link</a>

is what I need to do...(please see the link)

So far, I have this code...

PHP
<?php
$data = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'GET https://api.dudamobile.com/api/analytics/site/{site_name}?from=2015-01-12&result=activities');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, "{username}:{password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',       
    'Content-Length: ' . strlen($data))                                                                       
);   
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>
Posted
Updated 18-Apr-15 23:22pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900