Skip to content
Snippets Groups Projects
Commit 013a7c94 authored by Prasad's avatar Prasad
Browse files

Fixed magpierss for php 8.x

parent b0b67fdc
No related branches found
No related tags found
No related merge requests found
......@@ -82,6 +82,7 @@ require_once( MAGPIE_EXTLIB . 'Snoopy.class.inc');
\*=======================================================================*/
define('MAGPIE_VERSION', '0.72');
define('MAGPIE_CACHE_ON', false); /* Fix: XML_Parser cannot be serialized */
$MAGPIE_ERROR = "";
......@@ -265,17 +266,16 @@ function magpie_error ($errormsg="") {
Output: an HTTP response object (see Snoopy.class.inc)
\*=======================================================================*/
function _fetch_remote_file ($url, $headers = "" ) {
// Snoopy is an HTTP client in PHP
$client = new Snoopy();
$client->agent = MAGPIE_USER_AGENT;
$client->read_timeout = MAGPIE_FETCH_TIME_OUT;
$client->use_gzip = MAGPIE_USE_GZIP;
if (is_array($headers) ) {
$client->rawheaders = $headers;
}
$client->fetch($url);
return $client;
require_once 'vtlib/Vtiger/Net/Client.php';
$client = new Vtiger_Net_Client($url);
if (is_array($headers)) $client->setHeaders($headers);
$content = $client->doGet(null, MAGPIE_FETCH_TIME_OUT);
$res = new stdClass;
$res->status = $client->client->getResponseCode();
$res->results = $content;
return $res;
}
......
......@@ -91,7 +91,7 @@ class MagpieRSS {
* source encoding. (caveat emptor)
*
*/
function MagpieRSS ($source, $output_encoding='UTF-8',
function __construct ($source, $output_encoding='UTF-8',
$input_encoding=null, $detect_encoding=true)
{
# if PHP xml isn't compiled in, die
......@@ -106,7 +106,7 @@ class MagpieRSS {
$output_encoding, $input_encoding, $detect_encoding);
if (!is_resource($parser)) {
if (!is_object($parser)) {
$this->error( "Failed to create an instance of PHP's XML parser. " .
"http://www.php.net/manual/en/ref.xml.php",
E_USER_ERROR );
......@@ -449,7 +449,7 @@ class MagpieRSS {
*
*/
function create_parser($source, $out_enc, $in_enc, $detect) {
if ( substr(phpversion(),0,1) == 5) {
if ( substr(phpversion(),0,1) >= 5) {
$parser = $this->php5_create_parser($in_enc, $detect);
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment