so I am creating an auto import script and I know that cURL is more flexible but my question is, is it faster than file_get_contents? and which one is using more memory?
Write a simple script that makes a function call 1000 times and have one version that does file_get_contents and one version that does curl. Do you memory test at the beginning and end and test the difference. If it's just speed then you can use time() to check that. your thread title says faster, your post talks about memory so I'm not sure which one (both?) matters to you. function fgctest(){ //all the file gets contents stuff } function curltest(){ // all the curl stuff } $fgcTime = time(); for($i=0; $i < 1000; $i++){ fgctest(); } echo "<p>fgc time: ". time() - fgcTime; $curlTime = time(); for($i=0; $i < 1000; $i++){ curltest(); } echo "<p>curl time: ". time() - curlTime; Code (markup):
File_get_contents not designed for remote operation, it is suitable only for a local reception of the content, although it and do a lot of work analogues of CURL.