Help PHP can't crawl Web page, asked a few people did not solve
This post was last edited by dz215136304 on 2013-06-11 11:35:47
The URL must be the following code in the URL, tested, when fetching, if the parameter after Q with a space, he will automatically convert "&" to "&", resulting in data can not be crawled, directly in the Web page to enter the URL is to get content, to solve the method
$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 Web page
{
$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 to:
------Solution--------------------
Transcoding can be UrlEncode ()