Page 7 of 8
Re: Php link exporter
Posted: Sun Nov 29, 2009 7:17 am
by The_L
still error...
Warning: Invalid argument supplied for foreach() in /nfs/c02/h10/mnt/30579/domains/forum-racunara.com/html/taggrab.php on line 100
This is your code:
Code: Select all
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>";
And this is the one that works...
Code: Select all
echo "<h2>Links present on page: ".$urlrun."</h2><br />";
// Loop to pump out the results
echo "<table align=\"center\" bordercolor=\"#006600\" bgcolor=\"#CCCCCC\">";
$search = 'http://rapidshare.com/'; // matches *.rapidshare.com/
foreach ($linkarray as $link) {
if(strpos($link, $search) > -1) {
$link = rtrim($link, "\"");
echo "
<tr>
<td>$link</td>
</tr>";
}
}
echo "</table>";
Re: Php link exporter
Posted: Sun Nov 29, 2009 7:19 am
by iankent
So if that one works whats the problem?
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?
Re: Php link exporter
Posted: Sun Nov 29, 2009 7:22 am
by The_L
The difference is in the array function...
The one that woks exports just .rapidshare.com links i wanna add few more..:/
Re: Php link exporter
Posted: Sun Nov 29, 2009 7:30 am
by iankent
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

Re: Php link exporter
Posted: Sun Nov 29, 2009 7:33 am
by The_L
I just want to add
Code: Select all
array('.rapidshare.com','http://rapidshare.com');
but you got me confused with
To use an array you just need to add another loop inside your existing ones
Shouldnt i just change $search = ... to $search = array("....???
Re: Php link exporter
Posted: Sun Nov 29, 2009 7:34 am
by iankent
The_L wrote:I just want to add
Code: Select all
array('.rapidshare.com','http://rapidshare.com');
but you got me confused with
To use an array you just need to add another loop inside your existing ones
Shouldnt i just change $search = ... to $search = array("....???
Yep, just add extra patterns to the end of the $search array - you dont need to add another loop as that bits already been done.
edit: to add a 'dont' lol... kinda changes the whole answer
Re: Php link exporter
Posted: Sun Nov 29, 2009 7:51 am
by The_L
edit: to add a 'dont' lol... kinda changes the whole answer
Sorry i'm kinda bad at English..:/
Didn't quite catch that...
Re: Php link exporter
Posted: Sun Nov 29, 2009 8:20 am
by iankent
The_L wrote:edit: to add a 'dont' lol... kinda changes the whole answer
Sorry i'm kinda bad at English..:/
Didn't quite catch that...
sorry, didn't explain it well! I'd originally posted this:
Yep, just add extra patterns to the end of the $search array - you need to add another loop as that bits already been done.
which says "you need to add", but I meant this:
Yep, just add extra patterns to the end of the $search array - you dont need to add another loop as that bits already been done.
which as you can see, means the complete opposite!
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:02 am
by The_L
Code: Select all
$search = array('.rapidshare.com','.storage.to');
This is the line....but now script does not list anything..:/
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:03 am
by iankent
The_L wrote:Code: Select all
$search = array('.rapidshare.com','.storage.to');
This is the line....but now script does not list anything..:/
and thats all you changed from the version that was working?
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:09 am
by The_L
Yep...
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:10 am
by iankent
The_L wrote:Yep...
could you post the full code again, if thats all you've changed then it should still be outputting at least rapidshare links
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:32 am
by The_L
Code: Select all
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) {
if(strpos($link, $search) > -1) {
$link = rtrim($link, "\"");
echo "
<tr>
<td>$link</td>
</tr>";
}
}
echo "</table>";
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:38 am
by iankent
The_L wrote:Code: Select all
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
Re: Php link exporter
Posted: Sun Nov 29, 2009 9:43 am
by The_L
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...