file_get_contents resets connection?
-
Something I’ve been dealing with awhile and finally felt compelled to look into–
When doing a custom theme (editing template files within the theme editor), I’ll occasionally want to use the file_get_contents() command to pull data from some other site. But when I put the command in, then update, I get the “Problem loading page, The connection was reset” error from my browser, then have to wait a couple of minutes before the website comes back up.
I can bypass this by pulling the template file off the ftp, inserting the code with a text editor, and then re-uploading, but while the command works perfectly, it will continue to throw the same error if I ever try to update the file through WordPress’ back-end.
So my go-to workaround is to just create a function like:
function dontbreak_file_get_contents($string) {
return file_get_contents($string);
};and I can use that function without crashing. I’m on GoDaddy Linux server.
Does this sound like a hosting or WP issue?
- The topic ‘file_get_contents resets connection?’ is closed to new replies.