I use a third-party library that uses file_get_contents () to retrieve external documents. Since I am behind the proxy server, I got an error:
file_get_contents(http:
I tested get_contents () file with proxy setting via stream_context_create ():
$context = stream_context_create([
'http' => [
'proxy' => 'tcp://SERVERNAME:PORT',
'request_fulluri' => true
]
]);
and it works great !!
The problem is that I cannot configure a third-party library with proxy settings. Is there a way to configure this proxy setting so that file_get_contents () can use this parameter, for example with curl?
export http_proxy=http:
it works fine with curl from third-party libraries. But file_get_contents () does not seem to recognize environment variables.
export http_proxy=tcp:
export tcp_proxy=tcp:
both do not work.