0
votes

When i use file_get_contents or curl_exec with an url (http://google.com or other) return false with different context, user_agent, etc... No errors no Warnings

With local files it works, example: file_get_contents("a.txt");

Configuration:

Php.ini is right: allow_url_fopen = On

No Firewall: sudo ufw status: inactive

Phpinfo():

Protocols: dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, smtp, smtps, telnet, tftp

Host: x86_64-pc-linux-gnu

SSL: Version OpenSSL/1.0.1e

OpenSSL: support enabled

OpenSSL: Library Version OpenSSL 1.0.1e 11 Feb 2013

OpenSSL: Header Version OpenSSL 1.0.1e 11 Feb 2013

It is a dedicated server, maybe is there a physical firewall? or something I can't control?

Thank you very much

1
Try adding a context argument to file_get_contents that includes the useragent - similarly with your curl requestProfessor Abronsius
let us know what is the error?Dipanwita Kundu
Yes i tried. user_agent different context. curl_exec doesn't work neitherroverflow
No errors, No warnings, as i said it works with local fileroverflow
you mention google but is that the actual url you tried or is there a specific one for which your calls are failing?Professor Abronsius

1 Answers

0
votes

Thank you all so much for your comments:

Does running wget or curl on the command line of that server work? – apokryfos

Exactly was a server error not a php issue, i just use the easy way to fix it:

After some minutes trying to find something wrong with resolv.conf,head,.d

Just use this solution if you didn't modify nothing manually and you don't have a customized resolv

.I've removed resolvconf:

aptitude purge resolvconf

And i installed it again:

apt-get install resolconf