I bought a short url script, but I also use adf.ly, but this seems not possible, then I sold the script and now use only adf.ly as you do. thank yourandy wrote:can you tell us that we can use it too? like bit.ly and adf.ly? which lines in index we have to change?
XFileSharing Pro - deurl - Page 2
All the Deurl is done from lines 654 to 672 of index.cgi.
I'm not even remotely close to an expert in Perl let alone any other language but I found it trivial to change to Bit.ly.
Now I done this in XFS 1.8 so forgive me if it's different in 1.9 or 2.0.
In XFS settings panel put anything in the DeURL url box to activate.
Then replace the above code with this:
You can find all your API details for Adf.ly from: http://adf.ly/tools.php?api
I advise you change the key and uid unless you want me to make money (which I wouldn't mind lol).
advert_type can be int or banner
domain can be adf.ly or q.gs
If you want to create two short URLs for every link just copy the entire deurl block of code and paste it below it so you're repeating it twice.
e.g
Change to in the second block of code you pasted then in your upload_results.html use <TMPL_VAR deurl> and <TMPL_VAR deurl2> to retrieve the short urls.
I'm available for work if you can't get it working.
Code: Select all
if($c->{deurl_site} && $c->{deurl_api_key})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
my $author = $ses->getUser ? $ses->getUser->{usr_login} : '';
for(@arr)
{
my $res = $ua->post("$c->{deurl_site}/",
{
op => 'api',
api_key => $c->{deurl_api_key},
url => $_->{download_link},
size => sprintf("%.01f",$_->{file_size2}/1048576),
author => $author,
}
)->content;
($_->{deurl}) = $res=~/^OK:(.+)$/;
}
}
Now I done this in XFS 1.8 so forgive me if it's different in 1.9 or 2.0.
In XFS settings panel put anything in the DeURL url box to activate.
Then replace the above code with this:
Code: Select all
if($c->{deurl_site})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
for(@arr)
{
my $res = $ua->get('http://api.adf.ly/api.php?key=e8b9694d5e5cc8131c40b46db96a518f&uid=2113590&advert_type=int&domain=adf.ly&url='.$_->{download_link});
($_->{deurl}) = $res->decoded_content;
}
}
You can find all your API details for Adf.ly from: http://adf.ly/tools.php?api
I advise you change the key and uid unless you want me to make money (which I wouldn't mind lol).
advert_type can be int or banner
domain can be adf.ly or q.gs
If you want to create two short URLs for every link just copy the entire deurl block of code and paste it below it so you're repeating it twice.
e.g
Code: Select all
if($c->{deurl_site} && $c->{deurl_api_key})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
my $author = $ses->getUser ? $ses->getUser->{usr_login} : '';
for(@arr)
{
my $res = $ua->post("$c->{deurl_site}/",
{
op => 'api',
api_key => $c->{deurl_api_key},
url => $_->{download_link},
size => sprintf("%.01f",$_->{file_size2}/1048576),
author => $author,
}
)->content;
($_->{deurl}) = $res=~/^OK:(.+)$/;
}
}
if($c->{deurl_site} && $c->{deurl_api_key})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
my $author = $ses->getUser ? $ses->getUser->{usr_login} : '';
for(@arr)
{
my $res = $ua->post("$c->{deurl_site}/",
{
op => 'api',
api_key => $c->{deurl_api_key},
url => $_->{download_link},
size => sprintf("%.01f",$_->{file_size2}/1048576),
author => $author,
}
)->content;
($_->{deurl}) = $res=~/^OK:(.+)$/;
}
}
Code: Select all
($_->{deurl}) = $res=~/^OK:(.+)$/;
Code: Select all
($_->{deurl2}) = $res=~/^OK:(.+)$/;
I'm available for work if you can't get it working.
Bit.ly if you wish:
Replace [api] with your API key and [login] with your login.
Code: Select all
if($c->{deurl_site})
{
require LWP::UserAgent;
my $ua = LWP::UserAgent->new(timeout => 5);
for(@arr)
{
my $res = $ua->get('http://api.bit.ly/v3/shorten?login=[login]&apiKey=[api]&format=txt&longUrl='.$_->{download_link});
($_->{deurl}) = $res->decoded_content;
}
}
Last edited by trinsic on Jul 09, 2012 5:02 am, edited 1 time in total.