Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $original_item = $_GET['item'];
- $item = str_replace("\"", "", $original_item);
- $item = str_replace("\'", "", $item);
- $item = str_replace("\\", "", $item);
- $backpack_item = str_replace(" ", "+", $item);
- $steam_item = str_replace(" ", "%20", $item);
- $html_file = file_get_contents("DeineAPI=$backpack_item");
- $texttosearch = "<div class='media-body'>\n \t\t\t\t\t<h5 class='media-heading'>$original_item</h5>\n\t\t\t\t\t\tLounge: ";
- $csgobackpack_pos = strpos($html_file, $texttosearch);
- if($csgobackpack_pos != false) {
- $html_money_to_end = substr($html_file, $csgobackpack_pos + strlen($texttosearch));
- $lowest_price = substr($html_money_to_end, 0,strpos($html_money_to_end, " "));
- }
- else {
- $link = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=".$steam_item;
- $string = file_get_contents($link);
- $obj = json_decode($string);
- if($obj->{'success'} == "0") die("0");
- $lowest_price = $obj->{'lowest_price'};
- $lowest_price[strlen($lowest_price)] = 0;
- $lowest_price = str_replace("$","",$lowest_price);
- $lowest_price = (float)($lowest_price);
- }
- @include_once ("set.php");
- $rs = mysql_query("SELECT * FROM items WHERE name='$item'");
- if(mysql_num_rows($rs) > 0) {
- $row = mysql_fetch_array($rs);
- if(time()-$row["lastupdate"] < 3600) die($row["cost"]);
- }
- mysql_query("DELETE FROM items WHERE name='$item'");
- mysql_query("INSERT INTO items (`name`,`cost`,`lastupdate`) VALUES ('$item','$lowest_price','".time()."')");
- echo $lowest_price;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement