jeudi 22 janvier 2015

Doesn't show any output in this web-API

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 link is what I need to do...(please see the link)


So far, I have this code...



<?php
$data = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'GET http://ift.tt/15dDY3d');
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);
?>

Aucun commentaire:

Enregistrer un commentaire