Program ideas and related code

Source: Internet
Author: User
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 );}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.