For help with php, the webpage cannot be crawled. I asked a few people who did not solve this issue. In the end, the url edited by dz215136304 at 2013-06-11:35:47 must be the url in the following code. after testing, if the parameters after q contain spaces, he will automatically convert "& amp;" to "& ask for help. php cannot crawl the webpage. I have not solved the problem for a few questions.
At the end of this post, the url edited by dz215136304 at 11:35:47 must be the url in the following code. after testing, if the parameter after q is captured, it automatically converts "&" to "&", causing data to be unable to be crawled. you can directly enter the URL on the webpage to obtain the content.
$ Url = "http: // 110.75.65.8/search_turn_page_iphone.htm? Sort = & q = liz claiborne & page = 1 & showMode = list ";
Echo Post ($ url );
Function Post ($ url, $ post = null) // requested webpage
{
$ Context = array ();
If (is_array ($ post ))
{
Ksort ($ post );
$ Context ['http'] = array
(
'Timeout' => 60,
'Method' => 'post ',
'Header' => "> Accept-language: en/r/n ",
'Content' => http_build_query ($ post ,'','&'),
);
}
Return file_get_contents ($ url, false, stream_context_create ($ context ));
}
Error message:
Warning: file_get_contents(http://110.75.65.8/search_turn_page_iphone.htm?sort=&q=liz claiborne&page=1&showMode=list) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version Not Supported in F:\wwwroot\getTaobao\test.php on line 25
Share:
------ Solution --------------------
Urlencode () after Transcoding ()