lovelypotatoe
Newbie
- Apr 23, 2011
- 16
- 1
Very useful tips, man! Thank you
If you did want to actually use it to make money directly then you're best bet would be go for the same model as the other shortening services do and advertise to the users of your system. Just setup a simple script like Fatboy described above and then include an optin form on the main setup page for your users. Collect their email addresses to promote your other offers to them. You could also include advertisements on the setup page, either for your own offers or charge for advertising space. I'm sure with just a little bit of thought you could think of many more ways to monetize it as well.This is awesome! How could you make money out of it?
I think the best use of url shorteners isn't just to hide the destination url, but to really cut down on the length of the url for posting on platforms like twitter where you're limited to the number of characters you can have in a single post. I think for that use people willing to click the link understand the need for a short url and are less likely to be afraid of it seeming sketchy. Finding a cool looking short url would still be best if possible though.the link looks sketchy as all hell xDClever stuff many thanks tacopalypse.
Could this be then used as a public service like the others with ads on the site?
or would that "overheat" your hosting account?
but imo, bitly links and any url shortener links look pretty sketchy to begin with.
the intention that you're hiding the destination url is pretty obvious either way.
best way to make your links 'friendly looking' is to buy a dedicated domain for it and bounce redirects off of that, but that can get expensive
http://fatboy.me.uk/bhw/short.tar
Ah okay, didn't take as long as I thought.
The files I have created are the very basics - you will need a bit of error checking on them but the scripts work! You can probably tidy the code up to be easier (probably a config file with the common things in)
Grab them fromCode:hxxp://fatboy.me.uk/bhw/short.tar
<?php
$list = file_get_contents("list.txt");
$urls= explode ("\n",$list) ;
foreach ($urls as $array) {
$d = fopen ("hxxp://YOUROWNDOMAIN/create.php?url=".$array,"r");
fclose ($d);
}
?>
<?PHP
$folder = "folder/";
$handle = opendir($folder);
# Making an array containing the files in the current directory:
while ($file = readdir($handle))
{
$files[] = $file;
}
closedir($handle);
#echo the files
foreach ($files as $file) {
echo "hxxp://YOURDOMAINURL/".$file."<br />";
}
?>
Redirect /je5Hk http://www.domain.com/my-too-long-url-1.html
Redirect /k0etG http://www.domain.com/my-too-long-url-2.html
Redirect /bIu4g http://www.domain.com/my-too-long-url-3.html
Redirect /vBn2b http://wwwydomain.com/my-too-long-url-4.html
Redirect /y538r http://www.domain.com/my-too-long-url-5.html
http://www.domain.com/je5Hk
http://www.domain.com/k0etG
http://www.domain.com/bIu4g
http://www.domain.com/vBn2b
http://www.domain.com/y538r
Made a quick edit to be able to bulkupload and get a list with the URLs. I am in no way a coder, just a brainiac.
#1 Create a new phpfile in the root. I called mine bulk.php. Edit YOUROWNDOMAIN to, well, your own url where the script is located.
Code:<?php $list = file_get_contents("list.txt"); $urls= explode ("\n",$list) ; foreach ($urls as $array) { $d = fopen ("hxxp://YOUROWNDOMAIN/create.php?url=".$array,"r"); fclose ($d); } ?>
#2 Upload your list of websites you want to have shortened. Put them in list.txt with the script. Use regular hxxp://url formatting. One per line!
#3 Now run the script bulk.php by just visiting the adress where you uploaded it.
#4 Bonus - extract the shortened URL list! Upload the following and put it into list.php or whatever. Change "folder/" to whatever location you're storing the shortened linkfiles in. Also change YOURDOMAINURL to the actual URL used for the shortened links. What I mean is if you've installed the site in the root of the domain - then just use the domain. If you have any subfolders going on, just point it to domain/folder
Code:<?PHP $folder = "folder/"; $handle = opendir($folder); # Making an array containing the files in the current directory: while ($file = readdir($handle)) { $files[] = $file; } closedir($handle); #echo the files foreach ($files as $file) { echo "hxxp://YOURDOMAINURL/".$file."<br />"; } ?>
You should now have Bulk.php (importer) / List.php (show the shortened urls) and List.txt (your long urls you want converted). Hopefully it will help you some when generating shortened urls from sitemaps, feeds or whatever you have in mind.