How To Use TinyURL API In VB.Net
We Will See How To Implementing TinyURL's API In Visual Basic.NET (VB.NET) In This Post
Steps :
Create A New VB.Net Project Using Microsoft Visual Studio. Add 2 Label , 2 TextBox ['myurl' for accepting link from user and 'outputurl' for showing short link] and 2 Buttons As Shown Below
When We Will Click On 'Short URL' Button , The Program Is Supposed To Check Whether Their Is Internet Connection Available Or Not As It Will Require Network While Using TinyURL API. So If Their Is No Internet Connection Available , It Will Show A Message That You Don't Have An Active Connection And The Process Will Terminate Their. Use Following Code For This Purpose.
CODE :
After That We Have To Check That Whether The TextBox [Named As 'myurl'] Is Blank Or Not. If It Is Blank , Then We Have To Show A Message Something Link Enter Any Link To Short The Link. If There Is Already Any Link There In 'myurl' TextBox , Then We Will Proceed To Short The Link Using TinyURL API As We Have Done In PHP
TinyURL API : http://tinyurl.com/api-create.php?url=your_url_here
Replace 'your_url_here' With Your Desired Link
CODE :
Now For 'Copy Code' Button , We Will Again Check That The Output TextBox [Named 'outputurl'] Must Not Be Blank. After That We Will Copy Its Text By SelectAll() & Copy() Function
CODE :
In This Way , We Can Create Our Own Link Shortener Of TinyURL Using API In VB.NET
Complete Code :
Post a Comment