简体   繁体   中英

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

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 normal 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM