Extract the content of the webpage---urgent----super simple
I want to crawl the content of the site is this http://api.94qing.com/, such as the input solution dream to get the content after submission, how can I do ah, directly according to the website API operation prompt to get content, do not know why???
Share to:
------Solution--------------------
Need to pass cookies
Give 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 '); Chinese to UTF-8 encoded
echo qqlite_get (' elephant ');
Your search for the solution Dream keyword: Tiger
The results of the solution are as follows:
1. Zhou Gong Meng public number
2. Account Number: Magicstaff
3. Men dream of tigers-there will be difficulties on the road to success.
4. Women dream of Tigers – both themselves and their children will be ill.
5. Dreaming of tigers coming to themselves-there are difficulties.
6. Dream of shooting Tigers-the cause will be successful.
7. Dream of catching tigers-the bad omen, friends will be enemies.
8. Dreaming of tigers jumping on other animals-will worry about the situation of their friends.
9. Dreaming of tigers jumping on others--there will be a major accident, but a narrow escape.
Your search for the solution Dream keyword: Elephant
The results of the solution are as follows:
1. Zhou Gong Meng public number
2. Account Number: Magicstaff
3. Dream of an elephant, The Omen succeeds, the fame is very noisy.
4. Dream of riding an elephant, social status has been improved.
5. Dreaming of angry elephants rushing towards themselves, only perseverance can make a fortune.
6. Dream that only one tooth elephant, only concentrate on the business, can make a lot of money.
7. Dreaming of elephants spoil trees, will soon tide over the difficulties.
8. Dreaming of elephants kicking the lions with their feet is auspicious and can defeat their formidable opponents.
9. Dream of the Wild Elephant group, all efforts can be successful.
10. Married women dream of playing with a little elephant and have a beautiful boy.