1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

custom droid.ws php shorterner into forums

Discussion in 'PHP' started by stilv, Mar 28, 2013.

  1. #1
    i just finished making this code to work, but having a hard time making it look good

    
    <?php
     
     
    function curPageURL() {
    $pageURL = 'http';
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
    $pageURL .= "://";
    if ($_SERVER["SERVER_PORT"] != "80") {
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } else {
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    return $pageURL;
    }
     
    function droidwsURL($url) {
     
    $ch = curl_init();
     
    curl_setopt($ch, CURLOPT_URL, "http://droid.ws/api.php?url=".urlencode($url));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
     
    $shorturl = curl_exec ($ch);
    curl_close ($ch);
     
    return $shorturl;
     
    }
     
    ?>
    
    Code (markup):
    
    <?php
    echo droidwsURL (curPageURL());
    ?>
    
    Code (markup):
    working demo: http://stilv.com/test.php

    im trying to get now the <input feild to work or make it look like http://droid.ws input and have a button in the end says garb it


    any help will be great
     
    Last edited: Mar 28, 2013
    stilv, Mar 28, 2013 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    add a form with a input button and let php do the work after $_SERVER['REQUEST_METHOD'] == "POST"
     
    EricBruggema, Mar 28, 2013 IP
  3. stilv

    stilv Well-Known Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    155
    #3
    dont think i need $_post to get html to work here..
     
    stilv, Mar 29, 2013 IP
  4. stilv

    stilv Well-Known Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    155
    #4
    go here: http://droidtweak.com/topic/248166-instamagic-for-instagram-view-your-friends-images-on-your-live-wallpaper/

    on the user details left of the post, you see share me with a bit.ly url , i like to replace that with code above
     
    stilv, Mar 29, 2013 IP
  5. stilv

    stilv Well-Known Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    155
    #5
    any help will be great, thanks
     
    stilv, Apr 4, 2013 IP
  6. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #6
    Ok, let's start from the beginning.
    Are you trying to create a url shortening service? And you want to use the droid.ws API to accomplish it?
    Ok... so now, why what EricBrugemma was for you absurd? You may need a form! Unless you want to generate automatic URLS, right?

    Oh I think I got it! You want to automatically generate a short Link and post it in a forum for each new thread! Right?
     
    YoGem, Apr 5, 2013 IP
  7. stilv

    stilv Well-Known Member

    Messages:
    157
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    155
    #7
    that is correct, i have pm'ed EricBrugemma and he has been great on helping me get this to work
     
    stilv, Apr 5, 2013 IP
  8. YoGem

    YoGem Active Member

    Messages:
    676
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    90
    #8
    Great :) Good to know you had your issue fixed.
     
    YoGem, Apr 6, 2013 IP