I want to find a program idea and related code. for example, www.ccua.com.cn asks the webmaster for such a website function. Unfortunately, he refuses to reveal that I have no idea for the time being. can you give me some advice? ------ Solution ------------------ the content collected through curl is originally collected through file_get_contents ($ url. Helpless, a coding fault always finds a program idea and 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 );}