From 26b20e9f1d3e832f88f774e4f1685cafb9715821 Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Mon, 28 Jan 2013 00:07:08 +0100 Subject: [PATCH] =?UTF-8?q?=09modified:=20=20=20index.php=20=09modified:?= =?UTF-8?q?=20=20=20xsaf2.php=20-=20remplacement=20de=20l'API=20du=20valid?= =?UTF-8?q?ateur=20de=20flux=20W3C=20par=20contr=C3=B4le=20simple=20du=20X?= =?UTF-8?q?ML=20tir=C3=A9=20de=20VVB=201=20-=20(performances=20avec=20XSAF?= =?UTF-8?q?=20=C3=A0=20v=C3=A9rifier)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 13 ++++++++++--- xsaf2.php | 11 +++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 38ec6c1..e57fc2b 100755 --- a/index.php +++ b/index.php @@ -21,10 +21,17 @@ function get_title_from_feed($url) function get_link_from_feed($url) { // get site link from feed - $validator = "http://validator.w3.org/feed/check.cgi";$validator .= "?url=".$url;$validator .= "&output=soap12"; - $response = file_get_contents($validator);$a = strpos($response, '', 0)+12;$b = strpos($response, '', $a);$result = substr($response, $a, $b-$a); - if($result == "false") { die('le flux n\'a pas une syntaxe valide'); } $data = file_get_contents("$url"); + $xml = simplexml_load_string($data); // quick feed check + if (isset($xml->entry)) // ATOM feed. + {$result="true";} + elseif (isset($xml->item)) // RSS 1.0 /RDF + {$result="true";} + elseif (isset($xml->channel->item)) // RSS 2.0 + {$result="true";} + else + {$result="false";} + if($result == "false") { die('le flux n\'a pas une syntaxe valide'); } $check = substr($data, 0, 5); if($check !== '', 0)+12;$b = strpos($response, '', $a);$result = substr($response, $a, $b-$a); +$xml = simplexml_load_file($rssurl); // quick feed check +if (isset($xml->entry)) // ATOM feed. + {$result="true";} +elseif (isset($xml->item)) // RSS 1.0 /RDF + {$result="true";} +elseif (isset($xml->channel->item)) // RSS 2.0 + {$result="true";} +else + {$result="false";} /* autoblog */ if($social==FALSE and $result!=="false")