PHP: Iji Is.gd API ibelata URL

Depositphotos 11843590 nwere

Naanị gụọ otu isiokwu banyere uru na ọghọm dị na ya Mgbu URL dị na SEOmoz. M ahu nagide API Is.gd ime nke a na SMS WordPress ngwa mgbakwunye na m dere (ugbu a na-anwale ma na-eme nke ọma!).

function doCurlRequest ($ url, $ agbanwe, $ uru) {$ api = $ url. "?". $ agbanwe. "=". $ uru; $ nnọkọ = curl_init (); curl_setopt ($ nnọkọ, CURLOPT_URL, $ api); curl_setopt ($ nnọkọ, CURLOPT_RETURNTRANSFER, 1); $ data = curl_exec ($ nnọkọ); curl_close ($ nnọkọ); laghachi $ data; } ọrụ doShortenURL ($ longurl) {$ url = "http://is.gd/api.php"; $ agbanwe = "longurl"; $ shorturl = doCurlRequest ($ url, $ agbanwe, $ longurl); laghachi $ shorturl; }

Ndị mmadụ chere na i nwere ike inwe ekele maka koodu nlele n'ezie. Jide n'aka na ị dochie anya okwu funkified nke na-etinye nke a na blog na-agbakwunye. Iji jiri, tinye naanị ọrụ ndị dị n'elu na ibe PHP gị wee mepụta otu a:

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

M ga-agbakwunye agbakwunye / gbalịa mgbochi iji jide n'aka. Koodu a na - arụ ọrụ na PHP 5 + site na iji rụọ ọrụ n’ọbá akwụkwọ cURL. Ọ bụrụ na onye na-elekọta gị anaghị enyere gị aka, chọta onye ọbịa ọhụụ.

otu okwu

  1. 1

Kedu ihe ị chere?

Ebe a na-eji Akismet iji belata spam. Mụta otu esi etinye usoro data gị.