Пример #1
0
 function __construct($method = 'GET', $uri = 'source', $shared_username = null, $shared_api_key = null)
 {
     $this->endpoint = BigML::getDomain() != null ? BigML::getDomain() : BigML::BIGML_ENDPOINT;
     $this->headers['Host'] = str_replace('https://', '', $this->endpoint);
     $this->endpoint .= BigML::isDevMode() == true ? '/dev' : '';
     $this->method = $method;
     $this->version = BigML::getVersion();
     $this->uri = $uri;
     $this->headers['Date'] = gmdate('D, d M Y H:i:s T');
     if ($shared_username != null && $shared_api_key != null) {
         $this->setParameter("username", $shared_username);
         $this->setParameter("api_key", $shared_api_key);
     } else {
         if (BigML::hasAuth()) {
             $this->setParameter("username", BigML::getUsername());
             $this->setParameter("api_key", BigML::getApiKey());
         } else {
             error_log("Cannot find BIGML AUTH");
         }
     }
     # set download uri
     $this->uri .= $method == "DOWNLOAD" ? '/download' : '';
     # set Response
     $this->setResponse();
 }