Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $url='http://oreno.imouto.org/post/index.json?limit=20&tags=hatsune_miku';
- $data = get_data($url);
- $obj = json_decode($data);
- /* gets the data from a URL */
- function get_data($url)
- {
- $ch = curl_init();
- $timeout = 5;
- curl_setopt($ch,CURLOPT_URL,$url);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
- $data = curl_exec($ch);
- curl_close($ch);
- return $data;
- }
- $json = json_encode($data);
- $callback = $_GET['callback'];
- echo $callback.'('. $json . ')';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement