Last active
September 8, 2015 05:18
-
-
Save HostOnNet/f01831297ae22a5b6ba7 to your computer and use it in GitHub Desktop.
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 | |
| $pageApi = file_get_contents_curl('http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=29492'); | |
| $itemInfo = json_decode($pageApi, true); | |
| echo "<pre>"; | |
| echo "Item Name: " . $itemInfo['item']['name'] . "\n"; | |
| echo "Item Price: " . $itemInfo['item']['current']['price'] . "\n"; | |
| echo "<hr>"; | |
| print_r($itemInfo); | |
| function file_get_contents_curl($url) { | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); | |
| curl_setopt($ch, CURLOPT_HEADER, 0); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); | |
| $data = curl_exec($ch); | |
| curl_close($ch); | |
| return $data; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment