Extract webpage content --- urgent ---- this is the website I want to crawl content ??? Extract webpage content --- urgent ---- super simple
This is the website where I want to capture content ??? Share:
------ Solution --------------------
Cookie needs to be passed
Assign a special function
Function QQLite_get ($ msg, $ type = 'jm '){
$ Url = 'http: // api.94qing.com ';
$ Cookiejar = realpath('cookie.txt ');
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_TIMEOUT, 5 );
Curl_setopt ($ ch, CURLOPT_USERAGENT, $ _ SERVER ['http _ USER_AGENT ']);
Curl_setopt ($ ch, CURLOPT_REFERER, $ url );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookiejar );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true );
$ R = curl_exec ($ ch );
Curl_setopt ($ ch, CURLOPT_URL, "$ url? Type = $ type & msg = $ msg ");
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ cookiejar );
$ R = curl_exec ($ ch );
Curl_close ($ ch );
Return $ r;
}
Echo QQLite_get ('Tiger'); // UTF-8 encoded Chinese
Echo QQLite_get ('elephant ');Keywords: Tiger
The result is as follows:
1. Zhou Gongjie Meng public account
2. account: MagicStaff
3. a man dreams of a Tiger-he will encounter difficulties on the road to success.
4. women dream of Tigers-both themselves and their children will be ill.
5. dream that tigers will throw at themselves-it will be difficult.
6. dream of shooting tigers-success in your career.
7. dreaming of capturing Tigers is a bad omen, and friends will take themselves as enemies.
8. dreaming that tigers will throw on other animals-worries about the situation of friends.
9. dream that tigers will throw on others-a major car accident may occur, but they can escape.
Keyword: Elephant
The result is as follows:
1. Zhou Gongjie Meng public account
2. account: MagicStaff
3. dream of elephants, success, reputation.
4. dreaming of riding an elephant improves social status.
5. an angry elephant rushed toward himself. only by perseverance can he make a fortune.
6. elephants with only one tooth can make a lot of money only by focusing on business.
7. dream of a treasure of elephants, and soon the difficulties will be overcome.
8. I dreamed that the elephant could beat his strong opponent by kicking and stepping on the lion.
9. dream of the wild elephant group, all efforts can be successful.
10. married women dream of playing with elephants and want to have a beautiful boy ..