Manhag Posted December 3, 2012 Share Posted December 3, 2012 hello i want to remotely open url using php file in cronjob which one uses less memory ?? file_get_contents iframe PHP curl: CURLOPT_URL ?? or it doesn't matter ? Quote Link to comment https://forums.phpfreaks.com/topic/271511-file_get_contents-or-iframe-less-memory-usage/ Share on other sites More sharing options...
requinix Posted December 3, 2012 Share Posted December 3, 2012 An IFRAME makes no sense. The other two will both return the same string, the only difference is that cURL gives you more control over how it retrieves the URL. Quote Link to comment https://forums.phpfreaks.com/topic/271511-file_get_contents-or-iframe-less-memory-usage/#findComment-1397043 Share on other sites More sharing options...
Christian F. Posted December 3, 2012 Share Posted December 3, 2012 (edited) In any case, memory size shouldn't be a concern at all in this case. If it is, then you either done something really inefficient, or you're fetching some really huge sites. Remember, images, CSS files, JS files and all other external references will not be fetched; Just the plain HTML of the URL in question. If you're doing the latter, then you might need to open up a socket and fetch from the stream one line at a time. That, however, is only for very special cases. Oh, as for what you should use: I'd go with cURL. Not only because it gives you more control, but also because some (most?) hosts disable retrieving files over the HTTP protocol with the file* family of functions. Edit, added: The big questions remains though: Why are you doing this, and what are you going to do with it? Might be better ways to accomplish what you want, which we would know if provided with more detail of its application. Edited December 3, 2012 by Christian F. Quote Link to comment https://forums.phpfreaks.com/topic/271511-file_get_contents-or-iframe-less-memory-usage/#findComment-1397078 Share on other sites More sharing options...
Manhag Posted December 6, 2012 Author Share Posted December 6, 2012 thanks i want to open multiple url in one file which make a certain operation "a facebook app" but this operation takes much resources "memory & processor" Quote Link to comment https://forums.phpfreaks.com/topic/271511-file_get_contents-or-iframe-less-memory-usage/#findComment-1397770 Share on other sites More sharing options...
Christian F. Posted December 6, 2012 Share Posted December 6, 2012 That (somewhat) explained the what, but no the why. In any case, it sounds like some poor designing for me. At least from the limited information I have so far. Quote Link to comment https://forums.phpfreaks.com/topic/271511-file_get_contents-or-iframe-less-memory-usage/#findComment-1397775 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.