Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Grand Exchange PHP

Poll

  1. 1. Poll

Please sign in or register to vote in this poll.

Featured Replies

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.

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';

 

}

 

 

 

 

 

?>

<?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] . '
';

?>

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

  • 1 month later...
  • 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

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.