rendered paste body<?php
/**
* @author Nick
* @copyright 2008
*/
$search = "blue";
$page = curl_init();
curl_setopt($page, CURLOPT_URL,
"http://itemdb-rs.runescape.com/results.ws?query=" . $search .
"&price=all&members=");
curl_setopt($page, CURLOPT_USERAGENT,
'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.8.1.13;) Gecko/20080311 Firefox/2.0.0.13');
curl_setopt($page, CURLOPT_RETURNTRANSFER, 1);
$file = curl_exec($page);
$source = explode("\n", $file);
if (strpos($source, "did not return any results"))
die("Search " . $search . " doesn't have results");
$y = 0;
for ($x = 0; $x < count($source); $x++)
{
if (strpos($source[$x], "items matched the search term"))
{
$items = explode(" ", $source[$x]);
$num = $items[1];
}
if (preg_match("/<img style=\"vertical\-align: middle\" src=.http:..www.runescape.com.*alt=\".*\"\stitle/",
$source[$x]))
{
if (strpos($source[$x], "Members") == true)
{
$m[$y] = "Members";
} else
{
$m[$y] = "Free";
}
$n[$y] = strip_tags($source[$x + 3]);
$p[$y] = strip_tags($source[$x + 4]);
$c[$y] = strip_tags($source[$x + 5]);
$y++;
}
}
print_r($n);
print_r($p);
print_r($c);
print_r($m);
?>