Explode Problem!
Posted: Sat Feb 07, 2009 10:16 am
Ok, so I am making something that will rip down a forum by parsing the thead IDS and the thread name.
So far I have it working to rip off the forum IDS and print them, then I use that forum ID to try and go back and parse again to get the thread ID. It will only get the first forum name and then stop
Here is the script:
Does anybody know why it only grabs the first forum name and stops? It works fine getting the IDS. Also, if i just do
echo 'boardid='.$boardArray[$i].'">'; It will print out excactly how it should split, so its not a mistake in that.
So far I have it working to rip off the forum IDS and print them, then I use that forum ID to try and go back and parse again to get the thread ID. It will only get the first forum name and then stop
Here is the script:
Code: Select all
<?php
$Site = file_get_contents('http://forum.tibia.com/forum/?subtopic=worldboards');
$boardArray[0] = "";
for ($i = 1; $i <= 74; $i += 1) {
$splitA = explode('boardid=', $Site);
$splitB = explode('">',$splitA[$i]);
$boardArray[$i] = $splitB[0];
$splitC = explode('boardid='.$splitB[0].'">', $Site);
$splitD = explode('</a><br>',$splitC[$i]);
echo '<p> '.$i.'. '.$splitB[0].' - '.$splitD[0];
}
?>
echo 'boardid='.$boardArray[$i].'">'; It will print out excactly how it should split, so its not a mistake in that.