stilv Posted March 27, 2013 Share Posted March 27, 2013 i run my own android url shortener and like to have an java output i can add to my other sites site: http://droid.ws api: http://droid.ws/api.php?url= demo: http://droid.ws/api.php?url=http://droidtweak.com any help will be great Link to comment
jdfwarrior Posted March 27, 2013 Share Posted March 27, 2013 i run my own android url shortener and like to have an java output i can add to my other sites site: http://droid.ws api: http://droid.ws/api.php?url= demo: http://droid.ws/api.php?url=http://droidtweak.com any help will be great 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> Link to comment
stilv Posted March 27, 2013 Author Share Posted March 27, 2013 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> shorturl=$(curl -s http://droid.ws/api.php?url={query}) 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> Link to comment
jdfwarrior Posted March 27, 2013 Share Posted March 27, 2013 I see, should it look like this? im not a good coder <script> shorturl=$(curl -s http://droid.ws/api.php?url={query}) 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> No, no, the thing I was talking about making was creating a workflow inside of Alfred 2, and that's it. It was submit the url to your service, get the short url back, display it in a notification and copy it to the clipboard as well. Assuming you have Alfred 2 and have the Powerpack, install the attached workflow. Pop up Alfred then type: short http://yahoo.com Replace http://yahoo.com with any url that you want to create a short url of. It should show a notification of what the new link is, and it should be available in your clipboard to paste wherever you need it as well Download Link to comment
stilv Posted March 28, 2013 Author Share Posted March 28, 2013 i see, demo http://droidtweak.com/topic/208372-fpse-for-android-is-the-fastest-most-compatible-ps1-emulator-for-handheld-devicesie-psx-playstation-1-more-than-200k-active-users/ on the user panel on left of post, you see the bit url shortener, that what im looking to replace with mine http://droid.ws/* Link to comment
stilv Posted March 28, 2013 Author Share Posted March 28, 2013 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()); ?> Link to comment
jdfwarrior Posted March 29, 2013 Share Posted March 29, 2013 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()); ?> If all you are doing is grabbing a short URL for the URL passed to the workflow, why don't you just use the workflow I posted to you before. That's EXACTLY what it does. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now