February 19, 200917 yr Been puzzling over this for a while now, i have managed to connect to the hiscores using PHP cURL functions but i cant quite do the same to g.e. PS although i managed to connect to hiscores using cURL i am really bad at cURL and need much more practise. The piece of information i am looking for in the source code: Current market price range: Minimum price: 3 Market price: 4 Maximum price: 5 Taken from the page: http://itemdb-rs.runescape.com/viewitem.ws?obj=9004 Not quite sure how to go about getting that data and turning it into a variable.
February 20, 200917 yr Hey, I'm trying to do the same, My thread: viewtopic.php?f=45&t=784299 If it helps, Heres my code so far (I'm also having problems, with grabbing the price, and displaying it): <?php $ch = curl_init(); $id = "9004"; curl_setopt($ch, CURLOPT_URL, "http://itemdb-rs.runescape.com/viewitem.ws?obj=".$id); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); $string = $output; if(preg_match("/price+(?=:)/", $string, $match)) { print_r($match); echo $match[0]; }else{ echo 'No match found'; } ?>
February 20, 200917 yr <?php $curlh = curl_init(); curl_setopt($curlh, CURLOPT_URL, 'http://itemdb-rs.runescape.com/viewitem.ws?obj=' . $_GET['id']); curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true); $src = curl_exec($curlh); curl_close($curlh); $item = array(); ereg('Minimum price: ([0-9\.km,])', $src, $item['min']); ereg('Market price: ([0-9\.km,]+)', $src, $item['mark']); ereg('Maximum price: ([0-9\.km,]+)', $src, $item['max']); echo ' Minumim: ' . $item['min'][1] . ' Market: ' . $item['mark'][1] . ' Maximum: ' . $item['max'][1] . ' '; ?>
February 22, 200917 yr Hey, I'm trying to do the same, My thread: viewtopic.php?f=45&t=784299 If it helps, Heres my code so far (I'm also having problems, with grabbing the price, and displaying it): [hide=]<?php $ch = curl_init(); $id = "9004"; curl_setopt($ch, CURLOPT_URL, "http://itemdb-rs.runescape.com/viewitem.ws?obj=".$id); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); $string = $output; if(preg_match("/price+(?=:)/", $string, $match)) { print_r($match); echo $match[0]; }else{ echo 'No match found'; } ?>[/hide] Don't hijack threads, jackass. 2257AD.TUMBLR.COM
April 11, 200917 yr Author You had a silly mistake in your code, thought I would clean that up. :thumbsup: <?php $curlh = curl_init(); curl_setopt($curlh, CURLOPT_URL, 'http://itemdb-rs.runescape.com/viewitem.ws?obj=' . $_GET['id']); curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true); $src = curl_exec($curlh); curl_close($curlh); $item = array(); ereg('Minimum price: ([0-9\.km,]+)', $src, $item['min']); ereg('Market price: ([0-9\.km,]+)', $src, $item['mark']); ereg('Maximum price: ([0-9\.km,]+)', $src, $item['max']); echo ' Minumim: ' . $item['min'][1] . ' Market: ' . $item['mark'][1] . ' Maximum: ' . $item['max'][1] . ' '; ?> EDIT: Thank you very much for your help.
Create an account or sign in to comment