Last active
August 29, 2015 13:57
-
-
Save morecchia/9570364 to your computer and use it in GitHub Desktop.
cUrl script to get discogs api data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url = "http://api.discogs.com/"; // add the resource info to the url. Ex. releases/1 | |
//initialize the session | |
$ch = curl_init(); | |
//Set the User-Agent Identifier | |
curl_setopt($ch, CURLOPT_USERAGENT, 'YOUR_APP_NAME_HERE/0.1 +http://your-site-here.com'); | |
//Set the URL of the page or file to download. | |
curl_setopt($ch, CURLOPT_URL, $url); | |
//Ask cURL to return the contents in a variable instead of simply echoing them | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
//Execute the curl session | |
$output = curl_exec($ch); | |
//close the session | |
curl_close ($ch); | |
echo $output | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment