Find a program idea and related code. I want to get such a website function, such as ghost ?, The content collected through curl is originally collected through file_get_contents ($ url. However, a coding fault has never been found to be a program idea or related code.
I want to get a feature like this website like http://www.ccua.com.cn/
Ask this webmaster, but he refuses to reveal it at all.
I don't have any ideas for the moment. can you give me some advice?
------ Solution --------------------
Collect content through curl
In this example, file_get_contents ($ url) is used to collect data. However, a code fault cannot be solved. Finally, select curl implementation. To use curl, copy the libeay32.dll and ssleay32.dll files in php to system32, and enable extension = php_curl.dll in php. ini.
The sample code is as follows.
PHP code
Function generateHtmlByCURL ($ url, $ filename) {$ ch = curl_init (); $ timeout = 1000; // set to 0 for no timeout curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_TIMEOUT, $ timeout); $ handles = curl_exec ($ ch); curl_close ($ ch ); file_put_contents ($ filename, $ handles );}