<?php
$ch = curl_init();
// SET FILE TO DOWNLOAD
curl_setopt($ch, CURLOPT_URL, "http://search.twitter.com/trends.json");
// curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// EXECUTE 2nd REQUEST (FILE DOWNLOAD)
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$content = curl_exec ($ch);
// CLOSE CURL
curl_close ($ch);
//Return API Data
$returndata = json_decode($content, true);
echo $returndata;
?>
Output
Array
could you please help me ... Thanks in advance
I want to integrate Twitter trends into my website ....
Started by mnjc, Jul 24 2010 09:59 AM
1 reply to this topic
#1
Posted 24 July 2010 - 09:59 AM
|
|
|
#2
Posted 24 July 2010 - 11:03 AM
instead of echo $returndata, do print_r($returndata), as print_r prints arrays as well. if you echo <pre> and </pre> around your print_r, the output looks better, and you can read your returned array much easier.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall


Sign In
Create Account

Back to top









