English 中文(简体)
文档_get_html
原标题:file_get_html gets an empty page

试图通过文档www.get_html获取某一网页的内容。

事情是,我以前设法这样做,但现在却给我一个没有错误的空洞结果。

file_get_contents( http://www.google.com ) or die( this is not a valid url ); 

the url is valid. i chekced it by pasting it to my browser.

我试图与用户——代理人玩 playing:

ini_set( user_agent ,  My-Application/2.5 );

甚至

ini_set( user_agent ,  Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.24 (KHTML like Gecko) Chrome/19.0.1055.1 Safari/535.24 );

but nothing.. any suggestions?

问题回答

可在 php.ini 采用“allow_url_f open”法,对该法进行罚款。





相关问题
how to fix html dom parser forbidden error?

i have been received that error recently from a web scrapping php code using html dom parser. Warning: file_get_contents(https://www.hltv.org/stats/teams/ftu?startDate=2023-03-05&endDate=2023-06-...

Using Simple_Html_Dom Find with 2 attributes

Does anyone know how i could use simple_html_dom s find function to find an html element specifying 2 attributes instead of 1? Like right now I was using $area2 = $html->find( td[width="450"] ); ...

<tbody> glitch in PHP Simple HTML DOM parser

I m using PHP Simple HTML DOM Parser to scrape some data of a webshop (also running XAMPP 1.7.2 with PHP5.3.0), and I m running into problems with <tbody> tag. The structure of the table is, ...

Removing nested tags with simpleHTML

I m trying to use simple_html_dom to remove all the spans from a snippet of HTML, and I m using the following: $body = "<span class= outer style= background:red >x<span class= mid style= ...

热门标签