"Http://m.baidu.com" "to Baidu Mobile-based, I mainly test the mobile side of the"
Direct simulation link to get Baidu search results reached more than 300 KB, push to the client browser that is using gzip compression also about 100KB, time-consuming close to 1.0s. But Baidu's own first get content to the browser only about 30KB. How to be the same as Baidu. Tried PHP several ways to get Baidu search results but in fact all the same, the style of everything loaded together.
For example:
$url = "http://m.baidu.com/s?word=". $kw;
$html =file_get_contents ($url);
$html > 300KB
Apache to open Web page compression sent to the browser and 97.8KB
the first get actually has a style already
but the actual Baidu sent the first get only 30.3KB, and the first get no style
How to be like Baidu, with the fastest speed push to the client browser, the style should be in the browser and then load themselves
Reply to discussion (solution)
The problem is a bit long, maybe not fully understood.
Just analyzed the Baidu mobile page, if you want to compress 300K to 30K, there are 2 key points:
1: The requested header needs to be added: Accept-encoding:gzip, deflate, SDCH, this returns the 100k,gzip decoding done
2: Bring a cookie that has visited Baidu home page, so it becomes 30K. This is done by first grabbing the cookie and then caching it to the file, and bringing the cookies with you when you need to query.
Look a little indefinitely. What is your specific practice? Can you put the code directly?
"My question above means that I want to nest a Baidu in my page, but crawled over the search result content I have to do two times to show the meaning of the process, but this procedure found to be time-consuming, crawling over the first time consumed, two times the processing time" This can be controlled ", Push to page Show this time (this push file found no way to be as small as Baidu) "
The problem is a bit long, maybe not fully understood.
Just analyzed the Baidu mobile page, if you want to compress 300K to 30K, there are 2 key points:
1: The requested header needs to be added: Accept-encoding:gzip, deflate, SDCH, this returns the 100k,gzip decoding done
2: Bring a cookie that has visited Baidu home page, so it becomes 30K. This is done by first grabbing the cookie and then caching it to the file, and bringing the cookies with you when you need to query.
Look a little indefinitely. What is your specific practice? Can you put the code directly?
"My question above means that I want to nest a Baidu in my page, but crawled over the search result content I have to do two times to show the meaning of the process, but this procedure found to be time-consuming, crawling over the first time consumed, two times the processing time" This can be controlled ", Push to page Show this time (this push file found no way to be as small as Baidu) "