]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/snapshot.php
Fix for regression introduced with my last update to the
[quix0rs-gnu-social.git] / lib / snapshot.php
index b15fe3a6cbae9360f0d884676e09b95906a0b49c..a16087ac00da648d6b3f43307be0c776a1b688b4 100644 (file)
@@ -27,7 +27,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -172,26 +172,13 @@ class Snapshot
     {
         // XXX: Use OICU2 and OAuth to make authorized requests
 
-        $postdata = http_build_query($this->stats);
-
-        $opts =
-          array('http' =>
-                array(
-                      'method'  => 'POST',
-                      'header'  => 'Content-type: '.
-                                   'application/x-www-form-urlencoded',
-                      'content' => $postdata,
-                      'user_agent' => 'StatusNet/'.STATUSNET_VERSION
-                      )
-                );
-
-        $context = stream_context_create($opts);
-
         $reporturl = common_config('snapshot', 'reporturl');
-
-        $result = @file_get_contents($reporturl, false, $context);
-
-        return $result;
+        try {
+            $request = HTTPClient::start();
+            $request->post($reporturl, null, $this->stats);
+        } catch (Exception $e) {
+            common_log(LOG_WARNING, "Error in snapshot: " . $e->getMessage());
+        }
     }
 
     /**