wordpress-xmlrpc-client icon indicating copy to clipboard operation
wordpress-xmlrpc-client copied to clipboard

SSL Certificate Problems

Open frankyjquintero opened this issue 8 years ago • 0 comments

Hola, he encontrado la necesidad de modificar una parte de tu codigo para solucionarlo curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); ya que sin esto los dominios con https no funcionan como deberia

private function requestWithCurl() { $ch = curl_init($this->endPoint); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this->request); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); if ($this->proxyConfig != false) { if (isset($this->proxyConfig['proxy_ip'])) { curl_setopt($ch, CURLOPT_PROXY, $this->proxyConfig['proxy_ip']); } if (isset($this->proxyConfig['proxy_port'])) { curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxyConfig['proxy_port']); } if (isset($this->proxyConfig['proxy_user']) && isset($this->proxyConfig['proxy_pass'])) { curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$this->proxyConfig['proxy_user']}:{$this->proxyConfig['proxy_pass']}"); } if (isset($this->proxyConfig['proxy_mode'])) { curl_setopt($ch, CURLOPT_PROXYAUTH, $this->proxyConfig['proxy_mode']); } } if ($this->authConfig) { if (isset($this->authConfig['auth_user']) && isset($this->authConfig['auth_pass'])) { curl_setopt($ch, CURLOPT_USERPWD, "{$this->authConfig['auth_user']}:{$this->authConfig['auth_pass']}"); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } if (isset($this->authConfig['auth_mode'])) { curl_setopt($ch, CURLOPT_HTTPAUTH, $this->authConfig['auth_mode']); } } $response = curl_exec($ch); if (curl_errno($ch)) { $message = curl_error($ch); $code = curl_errno($ch); $this->error = "curl: {$message} ({$code})"; $this->logError(); curl_close($ch); throw new Exception\NetworkException($message, $code); } $httpStatusCode = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpStatusCode >= 400) { $message = $response; $code = $httpStatusCode; $this->error = "http: {$message} ({$code})"; $this->logError(); curl_close($ch); throw new Exception\NetworkException($message, $code); } curl_close($ch);

    return $response;
}

frankyjquintero avatar Dec 23 '16 02:12 frankyjquintero