Is it possible to only show like 4 results from a page received with curl?
This is my script :
<?php
$ch = curl_init ("http://services.runescape.com/m=itemdb_rs/top100.ws?list=2&scale=0");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec($ch);
preg_match('#<tbody[^>]*>(.+?)</tbody>#is', $page, $matches);
foreach ($matches as &$match) {
$match = $match;
}
echo '<table>';
echo $matches[0];
echo '</table>';
?>
with a result of this
Leather vambraces Leather vambraces Free game item 9 12 3 +7% Bronze helm Bronze helm Free game item 53 72 19 +6% Air rune Air rune Free game item 22 30 8 +6% Varrock teleport Varrock teleport Members' only item 969 1,255 286 +5% Teleport to house Teleport to house Members' only item 862 1,137 275 +5% Teak logs Teak logs Members' only item 83 111 28 +5% Water orb Water orb Members' only item 1,491 1,930 439 +5%
(That's just a piece normally there are like 100 results)
So is there way that i can only like display 4 results?
~~~~~~~Edit~~~~~~
Is there a way to place the result from this :"
Leather vambraces 9 12 3 +7%
Bronze helm 53 72 19 +6%
Air rune 22 30 8 +6%
Varrock teleport 969 1,255 286 +5%
to this :
Leather vambraces
Bronze helm
Air rune
Varrock teleport
In a variable like $item['name']
?