]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/ping.php
Rebuilt HTTPClient class as an extension of PEAR HTTP_Request2 package, adding redire...
[quix0rs-gnu-social.git] / lib / ping.php
index 175bf8440b61b3f76608b398a2015112b667e424..5698c403875e52b584b80a5fd5f86d8b93a4699f 100644 (file)
@@ -44,20 +44,16 @@ function ping_broadcast_notice($notice) {
                                                                                                                                array('nickname' => $profile->nickname)),
                                                                                           $tags));
 
-            $context = stream_context_create(array('http' => array('method' => "POST",
-                                                                   'header' =>
-                                                                   "Content-Type: text/xml\r\n".
-                                                                   "User-Agent: StatusNet/".STATUSNET_VERSION."\r\n",
-                                                                   'content' => $req)));
-            $file = file_get_contents($notify_url, false, $context);
+            $request = HTTPClient::start();
+            $httpResponse = $request->post($notify_url, array('Content-Type: text/xml'), $req);
 
-            if ($file === false || mb_strlen($file) == 0) {
+            if (!$httpResponse || mb_strlen($httpResponse->getBody()) == 0) {
                 common_log(LOG_WARNING,
                            "XML-RPC empty results for ping ($notify_url, $notice->id) ");
                 continue;
             }
 
-            $response = xmlrpc_decode($file);
+            $response = xmlrpc_decode($httpResponse->getBody());
 
             if (is_array($response) && xmlrpc_is_fault($response)) {
                 common_log(LOG_WARNING,