Replace file_get_contents with HTTPClient in testfeed

This commit is contained in:
Mikael Nordfeldth 2015-01-22 11:30:36 +01:00
parent fac9f4e545
commit 3a0136fe1f
1 changed files with 6 additions and 3 deletions

View File

@ -51,9 +51,11 @@ if (!$sub) {
exit(1); exit(1);
} }
$xml = file_get_contents($feedurl); // Fetch the URL
if ($xml === false) { try {
print "Bad fetch.\n"; $xml = HTTPClient::quickGet($feedurl);
} catch (Exception $e) {
echo sprintf("Could not fetch feedurl %s (%d).\n", $e->getMessage(), $e->getCode());
exit(1); exit(1);
} }
@ -85,4 +87,5 @@ if ($skip || $count) {
} }
} }
echo "Calling event StartFeedSubReceive\n";
Event::handle('StartFeedSubReceive', array($sub, $feed)); Event::handle('StartFeedSubReceive', array($sub, $feed));