Re: PHP cURL to achieve simulation login and collection method of use
1, simple collection of
the simple collection referred to here refers to a single page GET request collection, it is easy to easily get the result of the page return even through the file_get_contents function.
code fragment of file_get_contents
[code]
$url ='http://demo.zjmainstay.cn/php/curl/simple.html';
$content = file_get_contents ($url);
echo statements; Jmainstay.cn/php/curl/simple.html';
$ch = curl_init ($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); / / / / / return data do not directly output
$content = curl_exec. NT; [/code]
two,
that requires parameters, a page request needs to pass some parameters, can be a GET request, or a POST request. The acquisition of this situation can still be realized by using file_get_contents outside some parameters, but we will not show it here.
code fragment cURL GET
this request, we can choose the search engine as a demonstration, for example, I Baidu search a word "PHP cURL", after entering the return, we will get a similar http://www.baidu.com/s? Ie=utf-8