Php code for capturing https content _ PHP Tutorial

Source: Internet
Author: User
Php captures the https content code. If file_get_contents is used directly, an error is returned. the copied code is as follows: $ url (xxx.com); file_get_contents ($ url); error: Warning: file_get_contents (xxx.com) [funct uses file_get_con, an error is reported;

The code is as follows:


$ Url = (https://xxx.com ");
File_get_contents ($ url );


Error:
Warning: file_get_contents (https://xxx.com) [function. file-get-contents]: failed to open stream: No such file or directory in D: wampwwwgrabber_clientindex.php on line 3

The curl method is acceptable:

The code is as follows:


$ Url = (https://xxx.com );
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
$ Result = curl_exec ($ ch );
Print_r ($ result );
?>


The following two statements are important:

The code is as follows:


Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );

Pipeline code: $ url = (https://xxx.com "); file_get_contents ($ url); error: Warning: file_get_contents (https://xxx.com) [funct...

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.