Example #1
0
 private static function get_via_http()
 {
     require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_aimysitemap' . DIRECTORY_SEPARATOR . 'HttpClient.php';
     try {
         $u = new AimySitemapURI(JURI::root());
         $u->setPath('/robots.txt');
         $r = AimySitemapHttpClient::get_url($u);
         if (is_array($r) && $r['head']['code'] == 200) {
             return $r['body'];
         }
     } catch (Exception $e) {
     }
     return null;
 }
Example #2
0
 public static function ping($se)
 {
     $se = strtolower($se);
     if (!isset(self::$ses[$se])) {
         return false;
     }
     $cfg = new AimySitemapConfigHelper();
     $sm_url = JUri::root() . $cfg->get('xml_path', '/sitemap.xml');
     $req_url = sprintf(self::$ses[$se], urlencode($sm_url));
     $u = new AimySitemapUri($req_url);
     $resp = null;
     AimySitemapHttpClient::set_ua_name('AimySitemapNotifier/3.16.0');
     $resp = AimySitemapHttpClient::get_url($u);
     if (is_array($resp) && isset($resp['head']) && $resp['head']['code'] == '200') {
         AimySitemapLogger::debug("Notifier: Sending ping to {$se}: OK");
         return true;
     }
     AimySitemapLogger::debug("Notifier: Sending ping to {$se}: FAILED ({$req_url})");
     return false;
 }
Example #3
0
 private static function socket_error_handler($code, $text, $f, $l)
 {
     self::$socket_errstr = $text;
 }