我試圖通過PHP連接到IIS Web服務器上的smartystreets API(liveaddress)。我從這裏複製了file_get_contents和cURL示例:SmartyStreets github PHP examples。它們都不工作。如果我將URL直接粘貼到瀏覽器中,它確實可行。 file_get_contents示例返回:嘗試所有已知解決方案後無法獲取file_get_contents或cURL
Warning: file_get_contents(https://api.qualifiedaddress.com/street-address/?street=817+Quail+Ln.+%2312+bakersfield%2C+ca+93309&auth-token=5Nk1%2FA) [function.file-get-contents]: failed to open stream: No such file or directory in C:\Inetpub\includes\myclass.php on line 28
我已經在phpinfo中確認allow_url_fopen已打開。我也嘗試設置一個user_agent。但是,這不起作用。
cURL示例返回false。
這可能是IIS的東西?或者可能是由於防火牆設置?如果是這樣,我該如何找出打開的端口?還有其他的可能嗎?謝謝!
我在下面回答了我自己的問題(這是一個與在API中使用ssl有關的問題),但保羅回答比我好。如果您遇到類似的問題,您可能需要閱讀這兩個文件才能獲得解決問題的完整路徑。 – dallin 2012-07-28 20:02:11