]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/scripts/testfeed.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / OStatus / scripts / testfeed.php
old mode 100644 (file)
new mode 100755 (executable)
index 316b20b..2a12069
@@ -35,7 +35,9 @@ END_OF_HELP;
 
 require_once INSTALLDIR.'/scripts/commandline.inc.php';
 
-if (empty($args[0]) || !Validate::uri($args[0])) {
+$validate = new Validate();
+
+if (empty($args[0]) || !$validate->uri($args[0])) {
     print "$helptext";
     exit(1);
 }
@@ -51,9 +53,11 @@ if (!$sub) {
     exit(1);
 }
 
-$xml = file_get_contents($feedurl);
-if ($xml === false) {
-    print "Bad fetch.\n";
+// Fetch the URL
+try {
+    $xml = HTTPClient::quickGet($feedurl, 'text/html,application/xhtml+xml');
+} catch (Exception $e) {
+    echo sprintf("Could not fetch feedurl %s (%d).\n", $e->getMessage(), $e->getCode());
     exit(1);
 }
 
@@ -85,4 +89,5 @@ if ($skip || $count) {
     }
 }
 
+echo "Calling event StartFeedSubReceive\n";
 Event::handle('StartFeedSubReceive', array($sub, $feed));