I'm trying to do a simple GET request and return whatever the response is too the screen. When i load the page i get a blank page. I feel like im close, but im not sure where i am going wrong.
I'm assuming that i should get some kind of response if it worked succesfully.
$url='https://api.bitbucket.org/1.0/user/';
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt($curl, CURLOPT_USERPWD, "username:password");
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
curl_exec($curl);
To not return a blank page, you need to write
echo curl_exec($curl);
or delete this line:
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);