Back to Question Center
0

Semalt: Mehato e 3 ho PHP Web Page Sekhahla

1 answers:

mokhoa oa ho tlosa dintlha ho tswa ho websaeteng kapa blog. Boitsebiso bona bo sebelisetsoa ho beha meta tags, litlhaloso tsa meta, li-keywords le li-link ho site, ho ntlafatsa tscURL ha e kene. ');

}

$ curl = curl_init

;

curl_setopt ($ curl, CURLOPT_URL, $ website_url);

curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 'nete);

$ output = curl_exec ($ curl);

curl_close ($ curl);

khutlisa chelete e tsoang ho $;

}

Mona, re ka bona hore na PHP cURL e kentsoe hantle kapa che. Li-cURL tse tharo tse kholo li lokela ho sebelisoa sebakeng sa mosebetsi le curl_init

e tla thusa ho qalisa lenaneo, curl_exec

e tla e phetha le curl_close

e tla thusa ho koala kgokahano. Liphetoho tse kang CURLOPT_URL li sebelisetsoa ho beha URL ea marang-rang eo re e hlokang ho e qeta. Ea bobeli CURLOPT_RETURNTRANSFER e tla thusa ho boloka maqephe a qhetsoeng ka fomoleng e fapaneng ho e-na le foromo ea oona e sa fetoheng, e qetellang e bonts'a leqephe lohle la websaete.

Mehato ea 3: Litsebiso tse hlakileng tsa Scrape ho Website:

Ke nako ea ho sebetsana le lits'ebeletso tsa file ea hau ea PHP le ho hlahisa karolo e itseng ea leqephe la hau la web. Haeba u sa batle boitsebiso bohle ho URL e itseng, u lokela ho fetola sebelisa mefuta ea CURLOPT_RETURNTRANSFER le ho totobatsa likarolo tseo u batlang ho li qhaqha.

haeba (setset ($ _ POST ['submit'])) {

$ html = scrapeWebsiteData ($ _ POST ['website_url']);

$ start_point = strpos ($ html, 'Latest Posts');

$ fin_point = strpos ($ html, '', $ start_point);

$ bolelele = $ qet_point- $ start_point;

$ html = substr ($ html, $ start_point, $ bolelele);

echo $ html;

}

Re u eletsa hore u hlaolele tsebo ea motheo ea PHP le Mantsoe a Kamehla pele u sebelisa leha e le efe ea melao ena kapa u hlahise blog kapa marang-rang a itseng bakeng sa merero ea botho.

December 8, 2017
Semalt: Mehato e 3 ho PHP Web Page Sekhahla
Reply