Hide OAuth secret token.
Hide OAuth secret token.

File last commit:

03778752b7d9
e8e6e71c5975
Show More
fredart_parse.php
54 lines | 1.4 KiB | text/x-php | PhpLexer
/ fredart_parse.php
Add most necessary files for admin interface.
r1 <?php
/******************************
* This script dependent on *
* XML_Feed_Parser PEAR module *
******************************/
require_once('include/admin.inc.php');
require_once("PEAR.php");
require_once("XML/Feed/Parser.php");
// Workaround since DreamHost disables allow_url_fopen
$ch = curl_init();
$timeout = 5; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, FEED_URL);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$feed_src = curl_exec($ch);
curl_close($ch);
// Use if allow_url_fopen not disabled
// $feed_src = file_get_contents(FEED_URL);
$feed = new XML_Feed_Parser($feed_src);
for ($count = 0; $count < 5; $count++) {
$entry = $feed->getEntryByOffset($count);
Finish (I think) refactoring to use DBAL.
r36 $dbConnection->executeUpdate('INSERT INTO fredart (pubdate, title, link) VALUES (FROM_UNIXTIME(?), ?, ?)', array($entry->pubdate, $entry->title, $entry->link));
Add most necessary files for admin interface.
r1 }
Switch to mysqli_* in other php files.
r5
Add most necessary files for admin interface.
r1 header('Content-Type: text/xml');
header('Content-Length: 440');
?>
<?php echo "<?xml version=\"1.0\" ?>\n"; ?>
<methodResponse>
<params>
<param>
<value>
<struct>
<member>
<name>flerror</name>
<value>
<boolean>0</boolean>
</value>
</member>
<member>
<name>message</name>
<value>Thanks for the ping.</value>
</member>
</struct>
</value>
</param>
</params>
</methodResponse>