Php link exporter

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!

Moderator: General Moderators

The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

Rotfl again empty list :/

Code: Select all

echo "<table align=\"center\">";
$search = 'http://rapidshare.com/'; // matches *.rapidshare.com/
foreach ($linkarray as $links) {
    if(strpos($link, $search) > -1) {
        echo "<tr>
           <td>$link</td>
           </tr>";
    }
}
echo "</table>";
exit;

Code: Select all

   preg_match_all($regex, $this->html, $matching_data); // match data between specificed tags 
    
    return $matching_data[0];
}
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

The_L wrote:Rotfl again empty list :/

Code: Select all

foreach ($linkarray as $links) {
$links should have been renamed $link
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

it works..

Okay now can i remove "s from exported links as script prints them like "link" what to do to be just link...

And how to put input box in table so i can center it too? :P
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

The_L wrote:it works..

Okay now can i remove "s from exported links as script prints them like "link" what to do to be just link..
You can either use

Code: Select all

$link = ltrim(rtrim($link,"\""), "\"");
or possibly if you change the result of parse_array to return $matching_data[1] instead that might clear it
The_L wrote:And how to put input box in table so i can center it too? :P
you shouldn't! put it inside a <div> and set text-align to center in CSS. using tables just for alignment isn't a good idea as they can be very unpredictable!
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

Rotfl now it shows just on the end of the link xD
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

The_L wrote:Rotfl now it shows just on the end of the link xD
what do you mean? the quote is still on the end? which one did you go with, changing the output of parse_array or using the ltrim() and rtrim() functions?
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

I changed this

Code: Select all

return $matching_data[1];
yep just on the end..so its link"
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

The_L wrote:I changed this

Code: Select all

return $matching_data[1];
yep just on the end..so its link"
hm, using:

Code: Select all

$link = rtrim($link, "\"");
inside the foreach loop should clear that
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

It works...one more thing and i wont bother you :D

Is it possible to make "select all" button??? :P
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

The_L wrote:It works...one more thing and i wont bother you :D

Is it possible to make "select all" button??? :P
what do you mean? what should it select all of?
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

For example a "Select all" button that would select (and copy / if possible) the list of links...
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

The_L wrote:For example a "Select all" button that would select (and copy / if possible) the list of links...
it'll depend on how you want to do it. are you going to give each link a checkbox? if so, then you can either add a link which redraws the whole page with the checkboxes ticked/unticked or you could use javascript to loop through and tick/untick them

what is it youre trying to do?
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

Simple without any check boxes and ticks...just a button that selects all links and copy them...
The_L
Forum Commoner
Posts: 64
Joined: Sun Nov 22, 2009 6:53 pm

Re: Php link exporter

Post by The_L »

Damn i cant insert an array...whatever i do i get some errors...:/

Code: Select all

echo "<h2>Links present on page: ".$urlrun."</h2><br />";
echo "<table align=\"center\" bordercolor=\"#006600\" bgcolor=\"#CCCCCC\">";
$search = array('.rapidshare.com','http://rapidshare.com');
foreach ($linkarray as $links) {
    foreach($links as $link) {
        foreach($search as $search_term) {
            if(strpos($link, $search_term) > -1) { // Now matching $search_term instead of $search
            $link = rtrim($link, "\"");
        <tr>
                 <td>$link</td>
  </tr>";
            }
        }
    }
}
echo "</table>";
Warning: Invalid argument supplied for foreach() in /nfs/c02/h10/mnt/30579/domains/forum-racunara.com/html/taggrab.php on line 100

Line 100 is :

Code: Select all

   foreach($links as $link) {
User avatar
iankent
Forum Contributor
Posts: 333
Joined: Mon Nov 16, 2009 4:23 pm
Location: Wales, United Kingdom

Re: Php link exporter

Post by iankent »

Not too sure, but you've cut off the echo " bit from from the very inside loop, that could be breaking it, i.e.

Code: Select all

$link = rtrim($link, "\"");
// echo " was missing here
echo "<tr>
    <td>$link</td>
</tr>";[/code
Post Reply