PHP Tutorial: php captures https content. PHP Tutorial: use file_get_contents directly to capture https content in php, and an error will be reported; program code $ url (xxx.com); file_get_contents ($ url); error: program code Warning: file_get_con PHP Tutorial: php captures https content
If you use file_get_contents directly, an error is returned;
Program code $ url = (https://xxx.com ");
File_get_contents ($ url );
Error:
Program code 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:
Program code $ 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:
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false );
Curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false );
Note: For more exciting tutorials, please follow the help HouseDesign TutorialTopic,
The program code $ url = (https://xxx.com); file_get_contents ($ url); error: program code Warning: file_get_con...