Jump to content

Get GE price in php script


teuneboon

Recommended Posts

I made a simple php script that uses curl to get the price of a ge item of the runescape site. Just place it on top of a .php file, and then you can call it by using: echo getprice(itemid); You can find the id of an item if you look at it in runescape grand exchange. Like for grain: http://teun.beijers.eu (making it english soon).

 

<?php

function getprice($id) {

   $url = "http://itemdb-rs.runescape.com/viewitem.ws?obj=".$id;

   $startat = "Market price: ";

   $stopat = "";

   $ch = curl_init();

   $timeout = 5;

   curl_setopt ($ch, CURLOPT_URL, $url);

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

   $start = curl_exec($ch);

   curl_close($ch);

   $exploded = explode($startat,$start);

   $exploded = explode($stopat,$exploded[1]);

   $result = str_replace('
','',nl2br($exploded[0]));

   return $result;

}

echo getprice(1947);//get grain price

?>

Xenoxai.png
Link to comment
Share on other sites

OMFG THIS IS SO AWESOME.

 

I <3 U.

 

lol.

My goals:
[b]5M coins:[/b] 4350K+ coins 200k+ items - 2 dec 
5M coins - 16 dec
I [b]have gotten[/b] my 5M by christmas.

-bah this is only here for historical purposes now, I got 20m+ already

 

"fail,well atleast the title,i wont read it with that colours"

"If you hadn't posted in rainbow I would actually give this a proper read"

"Colours suck."

*I remove colours*

"Where did all the colors go!? This is now 40% more likely to be tl;dr'd due to the lack of colors."

Link to comment
Share on other sites

Now is there a way to write a script that simply alerts you when the prices update? That would sure make 3a buying easier.

 

 

 

Gl with that, GE website updates like 10 minutes after the prices actually update, I already have such a trick that alerts me when the website updates.

 

 

 

 

 

And btw I was serious. This is awesome. I am so gonna learn some PHP to make myself a price tracker/calculator (for personal merchanting use) but school is coming so I dont have much time... :/

My goals:
[b]5M coins:[/b] 4350K+ coins 200k+ items - 2 dec 
5M coins - 16 dec
I [b]have gotten[/b] my 5M by christmas.

-bah this is only here for historical purposes now, I got 20m+ already

 

"fail,well atleast the title,i wont read it with that colours"

"If you hadn't posted in rainbow I would actually give this a proper read"

"Colours suck."

*I remove colours*

"Where did all the colors go!? This is now 40% more likely to be tl;dr'd due to the lack of colors."

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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