如何檢查與REST API的連接是否安全?API - 連接是否安全?
1)我建立了一個API,並希望確保連接運行SSL生成前響應並返回到客戶端..的用戶名和密碼在每個請求
2通電)和你怎麼能使用SSL進行fsockopen連接?
$this->url = 'api.domain.com';
$this->path = '/v1/json/account/user/pass/?id=123';
if($this->fp = fsockopen($this->url, $this->port, $errno, $errstr, $this->timeout)){
$write = "$this->method $this->path HTTP/1.1\r\n";
$write .= "Host: $this->url\r\n";
$write .= "Content-Type: $this->content_type\r\n";
$write .= "Connection: Close\r\n\r\n";
fwrite($this->fp, $write);
while($line = fgets($this->fp)){
if($line !== false) $this->response .= $line;
}
fclose($this->fp);
}
那麼,什麼樣的API?你如何連接到它?請在問題中添加更多細節。 – Piskvor
如何與fsockopen進行SSL連接? – clarkk