I’m calling this example request from within some PHP code on a web page:
https://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=twitterapi
I get the Json result back which is great – but it is always printed within the web page so my users can see it. How do I do the request but prevent it from outputting to the page?
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'https://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=twitterapi');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl_handle);
curl_close($curl_handle);
Thanks
Assuming you have also fixed the missing closing quote in your URL…
You are using the wrong variable to point to the curl handler in your second
curl_setopt()call, and therefore not setting the return transfer option correctly: