The cause of this failure is that the file_get_contents function is used in the QQ login code of PHPCMS V9 to obtain the https website of Tencent, which is encrypted and transmitted through ssl. Although we can install openssl extension for PHP so that the file_get_contents function can obtain the content, the obtained content is encrypted and cannot be decrypted normally.
My solution is to write a method to read data through curl and replace the original method of PHPCMS, as shown below:
First, find the \ phpcms \ modules \ member \ classes \ qqapi. class. Php file.
We add a method named get_ssl_content at the end of this qqapi. class. Php file. The code is as follows:
PHP
Public function get_ssl_content ($ url)
{
$ 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 );
Return $ result;
}
After the get_ssl_content method is added, we can go to the qqapi. class. search for "file_get_contents ($ url)" in php, find the location where it appears, and then determine whether the corresponding $ url address starts with https, replace this function with the get_ssl_content method we wrote above. The code is as follows:
PHP
$ Content = $ this-> get_ssl_content ($ url );
At this point, we have completed the rewrite work. At this time, PHPCMS should be able to log on through QQ normally.