PHP: Isticmaalka Is.gd API in la Gaabiyo URL

Kaydinta sawirrada 11843590 s

Kaliya aqriso maqaal ku saabsan faa'iidooyinka iyo dhibaatooyinka soo gaabinta URL-yada SEOmoz. Waxaan ka faa'iideystaa Is.gd API in tan lagu sameeyo SMS Plugin WordPress in aan qoray (hadda tijaabinaya oo sifiican u shaqeynaya!).

function doCurlRequest ($ url, $ variable, $ qiimaha) {$ api = $ url. "?". $ variable. "=". $ qiimaha; $ fadhiga = curl_init (); curl_setopt ($ fadhiga, CURLOPT_URL, $ api); curl_setopt ($ fadhiga, CURLOPT_RETURNTRANSFER, 1); $ data = curl_exec ($ fadhiga); xiritaanka ($ fadhiga); soo celi $ data; } shaqo doShortenURL ($ longurl) {$ url = "http://is.gd/api.php"; $ variable = "longurl"; $ shorturl = doCurlRequest ($ url, $ variable, $ longurl); soo celi $ gaabin; }

Dadyohow waxaad u maleyneysaa inaad qadarineyso nambarka saxda ah. U hubso inaad bedesho xigashooyinka funkified ee ku dhajinaya barta ku dar. Si aad u isticmaasho, kaliya ku dar howlaha kor ku xusan boggaaga PHP ka dibna u fuliya sidan oo kale:

doShortenURL ('http://thisis.my/long/url/with?lots=of&data=');

Waxaan u maleynayaa inaan ku dari lahaa isku day / qabasho si aan u hubiyo. Koodhkani wuxuu la shaqeeyaa PHP 5+ oo maktabadda cURL la shaqeeyay. Haddii martigeliyahaagu uusan awood u siinin curl, raadi marti-geliye cusub.

One comment

  1. 1

Maxay idinla tahay?

Boggani wuxuu isticmaalaa Akismet si loo yareeyo spam. Baro sida xogtaada faallooyinkaaga looga shaqeeyo.