Jump to content

is curl better than file_get_contents?


scarhand

Recommended Posts

Depends on what you're trying to do?  file_get_contents() just grabs the file with a standard GET request, no questions asked.  cURL can set cookies, and all sorts of stuff that real content grabbing might need, and it's also sometimes faster.

You can use curl to interact with other servers.  For instance, serverA can use curl to post info to a page on serverB and retrieve the results (if any).  file_get_contents, as darkwater said, simply grabs the page (the output, as in, what someone's browser would see) and puts it into a string.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.