PHPCMS V9 cannot log on via QQ normally solution

Source: Internet
Author: User
Tags install openssl php file

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.

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.