コード例 #1
0
 function testRestGET()
 {
     $http = new jHttp($_SERVER['HTTP_HOST']);
     $http->get($GLOBALS['gJConfig']->urlengine['basePath'] . 'rest.php/test/rest');
     $this->assertEqual($http->getStatus(), 200);
     $this->assertEqual($http->getContent(), 'this is a GET response. resturl=' . $GLOBALS['gJConfig']->urlengine['basePath'] . 'rest.php/test/rest');
 }
コード例 #2
0
 /**
  * Submitting a sitemap by sending an HTTP request
  * @return boolean
  */
 public function ping($uri)
 {
     $parsed_url = parse_url($uri);
     if (!$parsed_url || !is_array($parsed_url)) {
         return false;
     }
     $http = new jHttp($parsed_url['host']);
     $http->get($parsed_url['path'] . '?' . $parsed_url['query']);
     if ($http->getStatus() != 200) {
         return false;
     }
     return true;
 }