Beispiel #1
0
 /**
  * Makes the outgoing HTTP requests
  * Inside WordPress we can use wp_remote_post().
  * Outside WordPress, not so much.
  *
  * @param unknown $url        	
  * @param unknown $args        	
  * @return the HTML body
  */
 static function remotePostGetBodyOnly($url, $parameters, array $headers = array())
 {
     $response = PostmanUtils::remotePost($url, $parameters, $headers);
     $theBody = wp_remote_retrieve_body($response);
     return $theBody;
 }
 /**
  * Given a hostname, test if it has open ports
  *
  * @param string $hostname        	
  */
 public function testHttpPorts()
 {
     $this->trace('testHttpPorts()');
     $connectionString = sprintf("https://%s:%s", $this->hostname, $this->port);
     try {
         $response = PostmanUtils::remotePost($connectionString);
         $this->trace('wp_remote_retrieve_headers:');
         $this->logger->trace(wp_remote_retrieve_headers($response));
         $this->trace(wp_remote_retrieve_response_code($response));
         $this->protocol = 'HTTPS';
         $this->http = true;
         $this->https = true;
         $this->secure = true;
         $this->reportedHostname = $this->hostname;
         $this->reportedHostnameDomainOnly = $this->getRegisteredDomain($this->hostname);
         return true;
     } catch (Exception $e) {
         $this->debug('return false');
     }
 }