May 13, 200917 yr Hey, I'm designing a drop logger PHP page, and I wish for it to be able to retrieve the GE prices. Does anybody know how I can attempt this? :o ~Kray
May 13, 200917 yr Well, the first thing that comes to mind is to cURL them and use simpleXML, but I seem to remember that the URLs change or something, making that difficult... Also there is no light version of the GE.
May 13, 200917 yr It's fairly easy, you just need to know the ID of the item you want to grab... // Enter your item ID here. $itemid = 10392; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "http://itemdb-rs.runescape.com/viewitem.ws?obj=".$itemid); curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 3); curl_setopt($curl, CURLOPT_TIMEOUT, 6); $fullge = curl_exec($curl); $curl_http = curl_getinfo($curl, CURLINFO_HTTP_CODE); curl_close($curl); if ($curl_http == "404") { // For some reason Jagex has deleted the GE :D // Do whatever you need to here. } if (strpos($fullge, "The item you were trying to view could not be found.") !== FALSE) { // The item doesn't exist. // Do whatever you need to here. } ereg('Minimum price: ([0-9\.km,]+)', $fullge, $regex['minprice']); ereg('Market price: ([0-9\.km,]+)', $fullge, $regex['markprice']); ereg('Maximum price: ([0-9\.km,]+)', $fullge, $regex['maxprice']); /* * Element [1] of the $regex arrays now contains the prices from the GE. * Running them through trim() first is a good idea just to be safe. * */ // Just to prove it works! print_r($regex); Obviously that can very easily be turned into a function to grab the data for a given item ID.
Create an account or sign in to comment