1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[GET] Bulk Bit.ly Generator

Discussion in 'PHP & Perl' started by phpfail, Jun 16, 2012.

  1. phpfail

    phpfail Regular Member

    Joined:
    Aug 21, 2011
    Messages:
    237
    Likes Received:
    104
    Occupation:
    Webmaster / Internet Marketer
    Change BITLY USERNAME to your bit.ly username of course, and change the BITLY API KEY to your API key. (Found Here: http://bit.ly/a/your_api_key) then upload to your server in .php format.

    Then browse to your server and you will see a form asking for the URL you wish to be generated & the amount to make.

    You need to have a ? at the end of the URL, E.g.
    http://site.com/? or http://site.com/file.php? as the generator will make links like site.com/?24824242. If your URL already has a ? in it put an & on the end, E.g. site.com/?p=22&


    PHP:
    <?php
    function make_bitly_url($url){
        
    $format 'xml';
        
    $version '2.0.1';
        
    $bitly_login 'BITLY USERNAME';
        
    $bitly_api 'BITLY API KEY';
        
    $bitly 'http://api.bit.ly/shorten?version='.$version.'&longUrl='.urlencode($url).'&login='.$bitly_login.'&apiKey='.$bitly_api.'&format='.$format;
        
    $response file_get_contents($bitly);
        if(
    strtolower($format) == 'json'){
            
    $json = @json_decode($response,true);
            return 
    $json['results'][$url]['shortUrl'];
        }else{
            
    $xml simplexml_load_string($response);
            return 
    'http://bit.ly/'.$xml->results->nodeKeyVal->hash;
            }
        }
    if (isset(
    $_POST['doit'])&&($_POST['doit']==1)){
        
    $tocreate $_POST['tocreate'];
        
    $url $_POST['url'];
        echo 
    "<textarea cols='30' rows='30'>";
        for (
    $i=0;$i<$tocreate;$i++){
            
    $url $url.rand(0,9999999);
            
    $link make_bitly_url($url);
            echo 
    $link."\r\n";
            }
        echo 
    "</textarea><br /><br />";
        echo 
    "<a href=''>Create More Links</a>";
        exit;
        }

    echo 
    "<form action='' method='post'><input type='hidden' name='doit' value='1' />";
    echo 
    "URL: <input type='text' name='url' size='100' value='' /><br /><br />";
    echo 
    "Create X Bit.ly's Of The Above URL: <input type='text' size='1' name='tocreate' value='100' /><br /><br />";
    echo 
    "<input type='submit' value='Create Links' />";
    echo 
    "</form><br /><br />";
    echo 
    "(Remember To Include A ? At The End Of The URL Or A & If The URL Already Uses A ?)";
    ?>
    Leave a post if this helped you! I want to make sure someone gets some use out of it!
     
    • Thanks Thanks x 1
  2. xiMe33

    xiMe33 Junior Member

    Joined:
    Feb 24, 2012
    Messages:
    194
    Likes Received:
    38
    Thanks
     
  3. BotHere

    BotHere Junior Member

    Joined:
    May 12, 2012
    Messages:
    135
    Likes Received:
    28
    Location:
    Makassar
    will try it now, thx for share :D
     
  4. WizGizmo

    WizGizmo Super Moderator Staff Member Premium Member

    Joined:
    Mar 28, 2008
    Messages:
    3,844
    Likes Received:
    55,442
    NOTE: Since this is not actually a download, I have
    moved this thread to the "Other Scripting Languages"
    section.

    "Wiz"
     
    • Thanks Thanks x 2
  5. facebookdude

    facebookdude Elite Member

    Joined:
    Feb 28, 2010
    Messages:
    1,506
    Likes Received:
    2,490
    I think I posted this a while back.