Jump to content

stilv

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by stilv

  1. Just created this and seems to be working but needs to be cleaner looking, some how i cant add input code

    working: http://stilv.com/test.php

    <?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;
    
    }
    
    ?>
    
    
    <?php 
    echo droidwsURL (curPageURL()); 
    ?>
    
  2. This should be rather simple. Create a new workflow using, Templates->Keyword to Script to Notification. Set your keyword and titles appropriately, in the script, add...

    shorturl=$(curl -s http://droid.ws/api.php?url={query})
    echo $shorturl
    

     

    Then in the notification, set your title and for the Text, put: {query}

     

    Then one more step to make this a little nicer. Click the + in the top right of the workflow area, select Output->Copy to Clipboard. Double click it, in the big text box, put: {query}. Then mouse over your Run Script module, a little tab should appear on the right side, click that and drag it to your Copy to Clipboard output to connect them. Then all you would do is: keyword <url>

     

     

    I see, should it look like this? im not a good coder

     

     

    <script>
    echo $shorturl
    </script>
     
     
    <input onclick = "this.select()" type = 'text' id = "shorturl" class="sturl_field span5" ><a class="btn btn-primary btn-large"><span id="flashbtn">Copy Me!</span></a>
×
×
  • Create New...