URL Shortener PHP Library (Client) with Free APIsteemCreated with Sketch.

in utopian-io •  7 years ago  (edited)

I've decided to make PHP Library on Shortening URLs with API support, which is very easy to use and integrate in your own applications. Please note that the actual shortening process is happening in a closed-source server so this library is only the Client side.

Here is the github project: https://github.com/DoctorLai/URL-Shortener
Here is the web UI: https://rot47.net/_url/
And here is the sample code:

$obj = new URL();
$response = $obj->shorten("https://steemit.com/@justyy", array("try" => 1));
var_dump($response);
$response = $obj->shorten("https://steemit.com/@justyy", array("private" => 1));
var_dump($response);  
echo $response->url;

URL Shortening API endpoint

https://uploadbeta.com/api/url/

Parameters - url (GET or POST)

Required: specified the URL to lookup or shorten. When URL is already shortened, it will return e.g.

{"error":"found","errorCode":3,"data":{"id":"595","0":"595","count":"0","1":"0","flag":"7","2":"7","created":"1455395435","3":"1455395435","last":"1455395435","4":"1455395435","search":"0","5":"0"},"url":"https:\/\/rot47.net\/9B"}

Parameter - try (GET or POST)

Optional - Default = False: Do not attempt to shorten the URL. Just to check if the URL has been shortened before.

Parameter - private (GET or POST)

Optioal - Default = False: Do not list the link in the Links Browser.
Return - errorCode and error

  • "error" => "invalid url",
  • "errorCode" => 4
  • "error" => "found",
  • "errorCode" => 3,
  • "error" => "added",
  • "errorCode" => 0,
  • "error" => "success",
  • "errorCode" => 0,
  • "error" => "$url should start with http or https",
  • "errorCode" => 1
  • "error" => "not found",
  • "errorCode" => 2

Feel free to submit issues and PRs!



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for your time, to creating this software!

Your contribution cannot be approved yet.

  • Please choose a different descriptive title.

It seems the published repository includes only client code making calls to public yet closed-source API. The title should state that this is a client library.

Also, if the content states that the actual shortening process is happening in a closed-source server controlled by you, that would be better.

Please edit your post via utopian and reply this comment when you're done.

You can contact us on Discord.
[utopian-moderator]

  ·  7 years ago 

Thank you. Post updated according to your suggestion.

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @justyy I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x