The collection encountered a strange problem. the target address is www.zhibo8.com. the local environment is Windows XP + xmapp1.7.7file _ get_contents or curl. The home page is completely obtained and placed on a foreign server. for linux, if Apache2.0file _ get_contents is empty, the curl will be different from the one opened by the browser. the content is much less, but the & lt; bod collection encounters a strange problem.
Target address: www.zhibo8.com
Local environment: windows xp + xmapp 1.7.7
File_get_contents or curl are all correct, and the homepage is completely obtained;
Put it on a foreign server, linux, Apache 2.0
File_get_contents is empty
The curl is different from the one opened by the browser. the content is much less,The end tag is complete.
In addition, I used curl to send all the headers of the simulated browser, which is also incomplete.
Please help us analyze the possible causes and solutions. thank you!
------ Solution --------------------
It is probably a problem with the linux environment.
I caught www.fblife.com and passed the curl test in windows, but I couldn't get the complete code in linux.
This website is tested by CURL in Ubuntu9.10 and can be captured completely. I wonder if your linux configuration is correct?
------ Solution --------------------
Currently there are wooden... Very tangled
It is strange to say that the program is put under the website directory, and the information captured from the browser to access the program file is very complete, linux and windows can all be done, but the linux background is not good, and how to do it is not complete, I guess it may be a problem with linux configuration. You can try the wget command
------ Solution --------------------
The network of the server. access to China is not good. this is my guess. most of the hosts in China are okay.
------ Solution --------------------
Check the encoding.
$ String = iconv ('gb2312', 'utf-8 // ignore ', $ string );
------ Solution --------------------
To foreign servers
File_get_contents is empty
The permission may not be open or timeout may occur.
The curl will be different from the one opened by the browser, with less content
It is a Chinese-only website, and it is normal to see it abroad or not completely. Not many people can understand Chinese
Of course, it is also related to the timeout and curl support Library.
------ Solution --------------------
This is an advantage
------ Solution --------------------
Discussion
A very sad issue is found. if too many items are set, a problem may occur.
Function curl_file_get_contents ($ durl ){
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ durl );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 30 );
Curl_setopt ($ ch, CURLOPT_RETURNT ......