In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to solve the problem that the collection function of phpcms v9 can not be used. It is very detailed and has a certain reference value. Interested friends must finish reading it!
What if the collection function of phpcms v9 cannot be used?
The content of the website that cannot be collected by https is mainly because https does not support file_get_contents to obtain content, so you can consider using curl to obtain the content. (you need to enable curl, which can be viewed in pathinfo)
(1) Open phpcms\ modules\ collection\ classes\ collection.class.php
Add a new function to the class:
Protected static function curl_request ($url) {if (! function_exists ('curl_init')) {throw new Exception (' server not install curl');} $ch = curl_init (); curl_setopt ($ch, CURLOPT_URL,$url); curl_setopt ($ch, CURLOPT_HEADER,0); curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1) / / output the acquired data curl_setopt ($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER,false); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST,false); $result = curl_exec ($ch); curl_close ($ch); return $result;} when the call is prohibited
(2) find the function function get_htm and change the function
Protected static function get_html ($url, & $config) {if (! empty ($url) & & $html = @ file_get_contents ($url)) {if ($syscharset! = $config ['sourcecharset'] & & $config [' sourcetype']! = 4) {$html = iconv ($config ['sourcecharset'], CHARSET.'//TRANSLIT//IGNORE', $html);} return $html } else {return false;}}
Change to
Protected static function get_html ($url, & $config) {if (substr (trim ($url), 0,5) = = "https") {$html = @ self::curl_request ($url);} else {$html = @ file_get_contents ($url) } if (! empty ($url) & & $html) {if ($syscharset! = $config ['sourcecharset'] & & $config [' sourcetype']! = 4) {$html = iconv ($config ['sourcecharset'], CHARSET.'//TRANSLIT//IGNORE', $html);} return $html;} else {return false }}
Then save it and get the test results.
Do not know if there are any other bug, welcome to comment!
The above is all the content of how to solve the problem that the phpcms v9 collection function can not be used, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.