AwsInspector\Helper\Curl::getResponseCode PHP Метод

getResponseCode() публичный Метод

public getResponseCode ( ) : string
Результат string
    public function getResponseCode()
    {
        if (empty($this->responseStatus)) {
            throw new \Exception('No response status found');
        }
        $matches = [];
        preg_match('|HTTP/\\d\\.\\d\\s+(\\d+)\\s+.*|', $this->responseStatus, $matches);
        return $matches[1];
    }

Usage Example

Пример #1
0
 public function getHttpStatusCode($url)
 {
     $curlHelper = new Curl($url, [], $this->getSshConnection());
     $curlHelper->doRequest();
     return $curlHelper->getResponseCode();
 }