开发者

file_get_contents('http://localhost/api/index.php?get=x'); how to make it work?

开发者 https://www.devze.com 2023-02-13 19:05 出处:网络
On my local host i wanna test my API, put every time i use the statement : file_get_contents(\'http://localhost/api/index.php?get=x\');

On my local host i wanna test my API, put every time i use the statement :

file_get_contents('http://localhost/api/index.php?get=x');

the script stops with " timeout ", while the URL up there works fine when requested the nor开发者_Python百科mal way !.

Hint: i think it have something to do with the php.ini file !?

secondly, using cURL, (file_get_contents+stream_creat_content), would be faster ?, i needed it to respond very fast

Thanks in advance :)


This is probably more of a firewall issue than to do with php.ini.

The fastest way to do this, however, will always be a direct include() to a file path. It would probably require some re-working of the API (because you shouldn't set $_GET variables programmatically), but saves a ton of overhead. If you need this in production, it's most likely worth making the changes.

0

精彩评论

暂无评论...
验证码 换一张
取 消