2017-07-31 59 views
1

我使用的是Quickbooks PHP API,當我們將allow_url_fopen設置爲true時它工作正常。PHP Quickbooks API問題allow_fopen_url

But when we set allow_url_fopen to false then this API is not working.

I found that fetch function of OAuth library is not getting any response.

When I debug, it gives error like this "Fatal error: Uncaught exception 'OAuthException' with message 'making the request failed (dunno why)' "

要使用OAuth,我們必須將allow_url_fopen設置爲true?

回答

0

allow_url_fopen允許fopen,fsockopen等函數具有URL感知功能,因此這些函數可以讀取遠程數據。如果關閉此設置,則這些功能不再是URL感知的,這意味着您無法使用URL打開文件。我懷疑API正在使用這些函數來允許遠程連接。此設置是一項安全功能,可以阻止您的腳本訪問遠程文件。

+0

API正在使用OAuth庫並獲取內容,它正在使用它的fetch(http://php.net/manual/en/oauth.fetch.php)函數。 – Apoorva

+0

獲取方法很可能使用我前面提到的其中一個函數。在使用oAuth庫時,可以使用libcurl進行編譯,據我瞭解,lib curl不考慮allow_url_fopen設置。 –