I am trying to extract text from a web site, but it's not working out too well
I have tried Google, and all the responses seem to be from SQL database, and searcng through here I found Explode, which doesn't do what I need. I've also tried substr, but that just returns what I'm looking for.
In Excel Visual Basic, I would do something like this:
Code: Select all
Position = InStr(4600, a, "You are on rank ", vbTextCompare)
position2 = InStr(4600, a, "of ", vbTextCompare)
position3 = InStr(4600, a, " (Page", vbTextCompare)
rank = Mid$(a, Position + 15, position2 - (Position + 15))
howmany = Mid$(a, (position2 + 3), position3 - (position2 + 3))Code: Select all
<body>
<?php
$page=file_get_contents('http://aaotracker.4players.de/usertracker.php?userid=61239');
echo $page;
$pos = strrpos($page, "Username:");
echo $pos;
$needle='Username:';
echo substr('Username:',6,5);
$pos=strlen($page) - (strpos(strrev("Username"), strrev($page)) + strlen($page));
echo $pos;
echo "HH";
echo count($page);
echo "JJ";
$pieces = explode("[hborea]", $page);
echo $pieces[1];
echo $pieces[2];
echo $pieces[3];
echo $pieces[4];
?>
</body>Basically I want to find some text on the web page, and then read the next few characters until a return carriage, or space is found.
If anybody could give me some pointers it would be much appreciated.
Cheers.