Jump to content

I want to integrate Twitter trends into my website ....

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
mnjc

mnjc

    Newbie

  • Members
  • Pip
  • 1 posts
<?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

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
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