{"id":165,"date":"2016-08-20T07:48:22","date_gmt":"2016-08-20T07:48:22","guid":{"rendered":"http:\/\/wizardofbots.com\/network\/?p=165"},"modified":"2016-08-20T07:48:42","modified_gmt":"2016-08-20T07:48:42","slug":"mass-url-shortener-in-php-tinyurl-and-many-more","status":"publish","type":"post","link":"http:\/\/wizardofbots.com\/network\/mass-url-shortener-in-php-tinyurl-and-many-more\/","title":{"rendered":"Mass URL shortener in PHP, TinyURL and list of 230 url shortening services"},"content":{"rendered":"<p>Hey fellas, I&#8217;ve got this little exercise I did to do a mass url shortener using TinyURL API as an example, also I added a big list of API&#8217;s for shortening URLs like Bit.ly, Tiny.cc and more.<\/p>\n<p>You might not have any use for this, but its good for education, we didn&#8217;t use any cURL because the API is opened and with a simple file_get_contents we can see the result when we input the url to the main gate of this API, check it out:<\/p>\n<pre class=\"lang:php decode:true \">&lt;?php\r\n\/\/ we first create the function to not repeat ourselves\r\nfunction tinyurl($longUrl) {\r\n\t\/\/ We use the tiny_url API\r\n\t$short_url= file_get_contents('http:\/\/tinyurl.com\/api-create.php?url=' . $longUrl);\r\n\treturn $short_url; \/\/ an obviously return the data so you assign it to a variable\r\n}\r\n\/\/we specify the file which is in same folder of this script\r\n\/\/ make sure to paste line by line all the URLs in links.txt\r\n$filename = 'links.txt';\r\n\/\/ we open the file into variable\r\n$links = file($filename);\r\n$links_bucket = array(); \/\/ create our array before.\r\n\/\/ we will iterate the $links variable which assigned to file()\r\nforeach($links as $link) {\r\n\t\/\/ time to use the function that returns the shortened URL  \r\n\t$tinyURL = tinyurl($link);\r\n\t\/\/ and we push into the array that we will var_dump\r\n\tarray_push($links_bucket, $tinyURL);\r\n}\r\n\r\nvar_dump($links_bucket);<\/pre>\n<p>So with this example you can create your own functions either using file_get_contents for open API&#8217;s or cURL making POST request with proper credentials to get the output.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium aligncenter\" src=\"https:\/\/media.giphy.com\/media\/iDmIoiYy43dEQ\/giphy.gif\" alt=\"\" width=\"400\" height=\"224\" \/><\/p>\n<p>So here is the promised list of URL shortener services, I don&#8217;t know if some of them might help to cloak or anything, you will have to try it:<\/p>\n<ul>\n<li>bit.ly<\/li>\n<li>goo.gl<\/li>\n<li>tinyurl.com<\/li>\n<li>is.gd<\/li>\n<li>cli.gs<\/li>\n<li>pic.gd\u00a0\u00a0 \u00a0tweetphoto<\/li>\n<li>DwarfURL.com<\/li>\n<li>ow.ly<\/li>\n<li>yfrog.com<\/li>\n<li>migre.me<\/li>\n<li>ff.im<\/li>\n<li>tiny.cc<\/li>\n<li>url4.eu<\/li>\n<li>tr.im<\/li>\n<li>twit.ac<\/li>\n<li>su.pr<\/li>\n<li>twurl.nl<\/li>\n<li>snipurl.com<\/li>\n<li>BudURL.com<\/li>\n<li>short.to<\/li>\n<li>ping.fm<\/li>\n<li>Digg.com<\/li>\n<li>post.ly<\/li>\n<li>Just.as<\/li>\n<li>.tk<\/li>\n<li>bkite.com<\/li>\n<li>snipr.com<\/li>\n<li>flic.kr<\/li>\n<li>loopt.us<\/li>\n<li>doiop.com<\/li>\n<li>twitthis.com<\/li>\n<li>htxt.it<\/li>\n<li>AltURL.com<\/li>\n<li>RedirX.com<\/li>\n<li>DigBig.com<\/li>\n<li>short.ie<\/li>\n<li>u.mavrev.com<\/li>\n<li>kl.am<\/li>\n<li>wp.me<\/li>\n<li>u.nu<\/li>\n<li>rubyurl.com<\/li>\n<li>om.ly<\/li>\n<li>linkbee.com<\/li>\n<li>Yep.it<\/li>\n<li>posted.at<\/li>\n<li>xrl.us<\/li>\n<li>metamark.net<\/li>\n<li>sn.im<\/li>\n<li>hurl.ws<\/li>\n<li>eepurl.com<\/li>\n<li>idek.net<\/li>\n<li>urlpire.com<\/li>\n<li>chilp.it<\/li>\n<li>moourl.com<\/li>\n<li>snurl.com<\/li>\n<li>xr.com<\/li>\n<li>lin.cr<\/li>\n<li>EasyURI.com<\/li>\n<li>zz.gd<\/li>\n<li>ur1.ca<\/li>\n<li>URL.ie<\/li>\n<li>adjix.com<\/li>\n<li>twurl.cc<\/li>\n<li>s7y.us\u00a0\u00a0 \u00a0shrinkify<\/li>\n<li>EasyURL.net<\/li>\n<li>atu.ca<\/li>\n<li>sp2.ro<\/li>\n<li>Profile.to<\/li>\n<li>ub0.cc<\/li>\n<li>minurl.fr<\/li>\n<li>cort.as<\/li>\n<li>fire.to<\/li>\n<li>2tu.us<\/li>\n<li>twiturl.de<\/li>\n<li>to.ly<\/li>\n<li>BurnURL.com<\/li>\n<li>nn.nf<\/li>\n<li>clck.ru<\/li>\n<li>notlong.com<\/li>\n<li>thrdl.es<\/li>\n<li>spedr.com<\/li>\n<li>vl.am<\/li>\n<li>miniurl.com<\/li>\n<li>virl.com<\/li>\n<li>PiURL.com<\/li>\n<li>1url.com<\/li>\n<li>gri.ms<\/li>\n<li>tr.my<\/li>\n<li>Sharein.com<\/li>\n<li>urlzen.com<\/li>\n<li>fon.gs<\/li>\n<li>Shrinkify.com<\/li>\n<li>ri.ms<\/li>\n<li>b23.ru<\/li>\n<li>Fly2.ws<\/li>\n<li>xrl.in<\/li>\n<li>Fhurl.com<\/li>\n<li>wipi.es<\/li>\n<li>korta.nu<\/li>\n<li>shortna.me<\/li>\n<li>fa.b<\/li>\n<li>WapURL.co.uk<\/li>\n<li>urlcut.com<\/li>\n<li>6url.com<\/li>\n<li>abbrr.com<\/li>\n<li>SimURL.com<\/li>\n<li>klck.me<\/li>\n<li>x.se<\/li>\n<li>2big.at<\/li>\n<li>url.co.uk<\/li>\n<li>ewerl.com<\/li>\n<li>inreply.to<\/li>\n<li>TightURL.com<\/li>\n<li>a.gg<\/li>\n<li>tinytw.it<\/li>\n<li>zi.pe<\/li>\n<li>riz.gd<\/li>\n<li>hex.io<\/li>\n<li>fwd4.me<\/li>\n<li>bacn.me<\/li>\n<li>shrt.st<\/li>\n<li>ln-s.ru<\/li>\n<li>tiny.pl<\/li>\n<li>o-x.fr<\/li>\n<li>StartURL.com<\/li>\n<li>jijr.com<\/li>\n<li>shorl.com<\/li>\n<li>icanhaz.com<\/li>\n<li>updating.me<\/li>\n<li>kissa.be<\/li>\n<li>hellotxt.com<\/li>\n<li>pnt.me<\/li>\n<li>nsfw.in<\/li>\n<li>xurl.jp<\/li>\n<li>yweb.com<\/li>\n<li>urlkiss.com<\/li>\n<li>QLNK.net<\/li>\n<li>w3t.org<\/li>\n<li>lt.tl<\/li>\n<li>twirl.at<\/li>\n<li>zipmyurl.com<\/li>\n<li>urlot.com<\/li>\n<li>a.nf<\/li>\n<li>hurl.me<\/li>\n<li>URLHawk.com<\/li>\n<li>Tnij.org<\/li>\n<li>4url.cc<\/li>\n<li>firsturl.de<\/li>\n<li>Hurl.it<\/li>\n<li>sturly.com<\/li>\n<li>shrinkster.com<\/li>\n<li>ln-s.net<\/li>\n<li>go2cut.com<\/li>\n<li>liip.to<\/li>\n<li>shw.me<\/li>\n<li>XeeURL.com<\/li>\n<li>liltext.com<\/li>\n<li>lnk.gd<\/li>\n<li>xzb.cc<\/li>\n<li>linkbun.ch<\/li>\n<li>href.in<\/li>\n<li>urlbrief.com<\/li>\n<li>2ya.com<\/li>\n<li>safe.mn<\/li>\n<li>shrunkin.com<\/li>\n<li>bloat.me<\/li>\n<li>krunchd.com<\/li>\n<li>minilien.com<\/li>\n<li>ShortLinks.co.uk<\/li>\n<li>qicute.com<\/li>\n<li>rb6.me<\/li>\n<li>urlx.ie<\/li>\n<li>pd.am<\/li>\n<li>go2.me<\/li>\n<li>tinyarro.ws<\/li>\n<li>tinyvid.io<\/li>\n<li>lurl.no<\/li>\n<li>ru.ly<\/li>\n<li>lru.jp<\/li>\n<li>rickroll.it<\/li>\n<li>togoto.us<\/li>\n<li>ClickMeter.com<\/li>\n<li>hugeurl.com<\/li>\n<li>tinyuri.ca<\/li>\n<li>shrten.com<\/li>\n<li>shorturl.com<\/li>\n<li>Quip-Art.com<\/li>\n<li>urlao.com<\/li>\n<li>a2a.me<\/li>\n<li>tcrn.ch<\/li>\n<li>goshrink.com<\/li>\n<li>DecentURL.com<\/li>\n<li>decenturl.com<\/li>\n<li>zi.ma<\/li>\n<li>1link.in<\/li>\n<li>sharetabs.com<\/li>\n<li>shoturl.us<\/li>\n<li>fff.to<\/li>\n<li>hover.com<\/li>\n<li>lnk.in<\/li>\n<li>jmp2.net<\/li>\n<li>dy.fi<\/li>\n<li>urlcover.com<\/li>\n<li>2pl.us<\/li>\n<li>tweetburner.com<\/li>\n<li>u6e.de<\/li>\n<li>xaddr.com<\/li>\n<li>gl.am<\/li>\n<li>dfl8.me<\/li>\n<li>go.9nl.com<\/li>\n<li>gurl.es<\/li>\n<li>C-O.IN<\/li>\n<li>TraceURL.com<\/li>\n<li>liurl.cn<\/li>\n<li>MyURL.in<\/li>\n<li>urlenco.de<\/li>\n<li>ne1.net<\/li>\n<li>buk.me<\/li>\n<li>rsmonkey.com<\/li>\n<li>cuturl.com<\/li>\n<li>turo.us<\/li>\n<li>sqrl.it<\/li>\n<li>iterasi.net<\/li>\n<li>tiny123.com<\/li>\n<li>EsyURL.com<\/li>\n<li>urlx.org<\/li>\n<li>IsCool.net<\/li>\n<li>twitterpan.com<\/li>\n<li>GoWat.ch<\/li>\n<li>poprl.com<\/li>\n<li>njx.me<\/li>\n<\/ul>\n<p>Try it yourself and let me know how it worked \ud83d\ude09<\/p>\n<p>Im done by today I might come with other stuff later, Im on my PHP spree, I might change soon. So don&#8217;t question why I haven&#8217;t used other languages. I just feel like it.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey fellas, I&#8217;ve got this little exercise I did to do a mass url shortener using TinyURL API as an example, also I added a big list of API&#8217;s for shortening URLs like Bit.ly, Tiny.cc and more. You might not have any use for this, but its good for education, we didn&#8217;t use any cURL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,6],"tags":[91,14,90,88],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-php","category-tutorials","tag-explained-code","tag-php","tag-tinyurl","tag-tutorial"],"_links":{"self":[{"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":2,"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":167,"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/posts\/165\/revisions\/167"}],"wp:attachment":[{"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wizardofbots.com\/network\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}