Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getLastFM($url) {
- $curl = curl_init($url);
- curl_setopt($curl , CURLOPT_HEADER, 0);
- curl_setopt($curl , CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl , CURLOPT_URL, $url);
- if(curl_getinfo($curl, CURLINFO_HTTP_CODE) == '404') echo "ERROR 404!";
- $content = curl_exec($curl );
- if ($content === FALSE) {
- throw new RuntimeException("cURL exception: ".curl_errno($curl).": ".curl_error($curl));
- }
- curl_close($curl );
- return $content;
- }
- $content = getLastFM('http://www.last.fm/user/robinpr_eu/now');
- echo $content;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement