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.

How to get the GE price of an item using PHP?

Featured Replies

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

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.

C2b6gs7.png

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.

  • Author

Perfect, thanks :)

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.