Fetching remote content with curl
Lately I see lots of problems with bunch of website scripts still using fopen() function to retrieve remote urls. Usually problem isn’t in scripts themselves but in the mere fact that url_functions are more and more often disabled in webhost’s php configuration. I can’t say I blame them, pure thought off all the possible script exploits that are using url_fopen isn’t very comforting. What bothers me is php developers not wanting to accept new ways of retrieving remote content. I’m pretty sure that almost all webhosts have curl enabled, and curl is one powerful function in php. But still we can find tons of fopen functions wanting to retrieve remote content in almost all popular content management systems.
In the rest of the post I will present you with alternatives to fopen, as some examples and guidelines for retrieving remote url content. Post is a bit longer but bear with me. Read more