Gossamer Forum
Home : Products : Links 2.0 : Customization :

Export only URL's in txt-file

Quote Reply
Export only URL's in txt-file
Hello,

Is it possible to build in a some art of extension which will export only URL's from my database in txt-file. I want to use it for exter URL-verifier. I have a timeout restriction problem on my server and would like to verify links using some application on my desktop.

thanks in advance.
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
Hi,

Should be as simple as:

Code:
#!/usr/bin/perl

print "Content-Type: text/html \n\n";

my $data_folder = '/path/to/your/admin/data';

open(READIT,"<$data_folder/url.db") || die qq|Cant read: $data_folder/url.db . Reason: $!|;
open(WRITEIT,">$data_folder/urls_basic.txt") || die qq|Cant write: $data_folder/urls_basic.txt . Reason: $!|;
while (<READIT>) {
chomp;
my @split = split /\|/, $_;
print WRITEIT $split[1] . "\n";
}
close(WRITEIT);
close(READIT);

print "DONE!";

Obviously change the path to $data_folder [Smile

Then, when run -you should get a new file called urls_basic.txt , with all the URL's in.

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Export only URL's in txt-file In reply to
Hi.thank you for your reply!. It works! :))))
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
Hi,

Glad to hear it Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Export only URL's in txt-file In reply to
Can you help me to simply modify it?

I want that the" urls_basic.txt" file willbe saved in some other directory . not in cgi-bin directory. I have modified it to following:

Code:
#!/usr/bin/perl

print "Content-Type: text/html \n\n";

my $data_folder = '/var/www/vhosts/domain.com/cgi-bin/links3/admin/data';
my $download = '/var/www/vhosts/domain.com/httpdocs/fileadmin';

open(READIT,"<$data_folder/url.db") || die qq|Cant read: $data_folder/url.db . Reason: $!|;
open(WRITEIT,">$download/urls_basic.txt") || die qq|Cant write: $download/urls_basic.txt . Reason: $!|;
while (<READIT>) {
chomp;
my @split = split /\|/, $_;
print WRITEIT $split[1] . "\n";
}
close(WRITEIT);
close(READIT);

print "DONE!";

But it will be not saved here. Waht did I wrong here?

thanks in advance
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
Hi,

Are you getting an error message? Most likely, its because you need to CHMOD the folder to 777 :)

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Export only URL's in txt-file In reply to
I don't getting an error message. It seems to work. because I have onyl see "Done". The folder is already chmod with 777
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
I want to make it because I can't open this file in my browser. Because it will be saved in cgi-bin directory an I receive the following message trying opening it in my browser

Quote:
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, ave@domain.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
Hi,

Try adding this:

Code:
use CGI::Carp qw(fatalsToBrowser);

..right after:

Code:
#!/usr/bin/perl

..so it looks like:

Code:
#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

Hopefully that will give you the error message then.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Export only URL's in txt-file In reply to
I made it. I receive only the messeage "Done" . But The file will not be saved in the fileadmin dircetory!
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
Hi,

Try this:

Code:
#!/usr/bin/perl

print "Content-Type: text/html \n\n";

my $data_folder = '/var/www/vhosts/domain.com/cgi-bin/links3/admin/data';
my $download = '/var/www/vhosts/domain.com/httpdocs/fileadmin';

open(READIT,"<$data_folder/url.db") || die qq|Cant read: $data_folder/url.db . Reason: $!|;
open(WRITEIT,">$data_folder/urls_basic.txt") || die qq|Cant write: $data_folder/urls_basic.txt . Reason: $!|;
while (<READIT>) {
chomp;
my @split = split /\|/, $_;
print WRITEIT $split[1] . "\n";
}
close(WRITEIT);
close(READIT);

system("mv $data_folder/urls_basic.txt $download/urls_basic.txt") || die $!;
print qq|Moving from: $data_folder/urls_basic.txt to $download/urls_basic.txt \n<br />|;

print "DONE!";

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Dec 21, 2007, 9:06 AM
Quote Reply
Re: [Andy] Export only URL's in txt-file In reply to
thank YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Smile it works!!

mery christmas :)

have a nice day!
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
hehe - np =) Merry Xmas to you too.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
Are you aware that there is already a file in your admin/data directory (url.db) that contains a list of URLs? It is in the format of nnn|URL where nnn is the ID number of the resource link and URL is the recorded database URL. That file is updated every time your rebuild the links.
Quote Reply
Re: [Bobsie] Export only URL's in txt-file In reply to
Hi,

Wow, long time no seed Bobsie =)

I think he was, but he needed it in format of

url
url
url

..as the checker he is using only allows for one URL per line, and nothing else (thus the script I wrote to extract the URL's :))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [uhrwerk] Export only URL's in txt-file In reply to
I use: http://gsitecrawler.com/

It lets you select all types of formats and the software is FREE.
I like it because you can filter the results and let it work in the background.

Good luck


Sandra Roussel
Chonsa Group Design - Fresh Start Housing