PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
echo "<h2>Links present on page: ".$urlrun."</h2><br />";
// Loop to pump out the results
echo "<ul>";
// create an array of terms to find
$search = array('.rapidshare.com','http://rapidshare.com');
foreach ($linkarray as $links) {
foreach($links as $link) {
// loop through the search terms wit ha foreach
foreach($search as $search_term) {
// Comment out the next line to manually check the results
if(strpos($link, $search_term) > -1) { // Now matching $search_term instead of $search
// Leave the next line here
echo "<li>$link<li>";
// And comment out the next line
}
}
}
}
echo "</ul>";
The reason the first code block doesn't work is because its reverted to having the extra foreach loop that we dropped many posts ago. Anyway, if it works, problem solved?
The_L wrote:The difference is in the array function...
The one that woks exports just .rapidshare.com links i wanna add few more..:/
Then have a think about how you're currently identifying rapidshare links and how you can extend that to include additional patterns. Throughout the last 7 pages you've definately got all the code you need to do it
Take a backup of what you have now while its working, try some changes (just one or two at a time, and undo them if they break it completely) to try and get it doing what you want, and if you get stuck let me know
echo "<h2>Links present on page: ".$urlrun."</h2><br />";
echo "<table align=\"center\" bordercolor=\"#006600\" bgcolor=\"#CCCCCC\">";
$search = array('.rapidshare.com','.storage.to');
foreach ($linkarray as $link) {
foreach($search as $search_term) { // this line had gone
if(strpos($link, $search_term) > -1) { // this line should contain $search_term not $search
$link = rtrim($link, "\"");
echo "
<tr>
<td>$link</td>
</tr>";
}
} // this line had gone
}
echo "</table>";
looks like you've removed the foreach bit for $search. $search is an array, so you have to loop through that and run strpos against each array element
Nope,does not list anything...:/
First i added and replaced all you commented...and nope nothing listed...
And then i just copyed your code from here and again...nothing...