belick Posted January 15, 2008 Share Posted January 15, 2008 I am using include "http://www.com" and I know that there is another way to do so by fget or other functions... do you know what is the best way also to save memory? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/ Share on other sites More sharing options...
Lumio Posted January 15, 2008 Share Posted January 15, 2008 use fopen, fgets, fread, ... Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/#findComment-439962 Share on other sites More sharing options...
cooldude832 Posted January 15, 2008 Share Posted January 15, 2008 I am using include "http://www.com" and I know that there is another way to do so by fget or other functions... do you know what is the best way also to save memory? Thanks You shouldn't beable to use include or require on a file that has an invalid local pointer path as the one you described did. Also fget, fopen will get you the http response text from that file being called (if it outside your server as you are suggesting) Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/#findComment-439965 Share on other sites More sharing options...
aris1 Posted January 15, 2008 Share Posted January 15, 2008 HI! IN PHP 4 I USED INCLUDE("HTTP://WWW.EXAMPLE.COM?POSITION=0&&WEBSITE=WWW.OK.COM"); CAN U TELL ME A DIFFERENT WAY IN PHP 5....(NOT JAVASCRIPT) ALL I WANT IS TO PREVENT,WHEN SOMEBODY SEE "VIEW SOURCE" NOT TO BE ABLE TO SEE MY PATH!!! CAN HELP SOMEBODY IN PHP FREAKS?? Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/#findComment-440022 Share on other sites More sharing options...
mr_mind Posted January 15, 2008 Share Posted January 15, 2008 file_get_contents("http://www.example.com?POSITION=0&&WEBSITE=www.ok.com"); Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/#findComment-440023 Share on other sites More sharing options...
belick Posted January 16, 2008 Author Share Posted January 16, 2008 I am able to use the include with URL after editing the php.ini in ver 4.4... my question is if its normal to use it or I should stick to fopen, fgets, fread, ... Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/#findComment-440501 Share on other sites More sharing options...
trq Posted January 16, 2008 Share Posted January 16, 2008 It would be best to use [url=http://php.net/file_get_contents]file_get_contents . From the manual: file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance. Quote Link to comment https://forums.phpfreaks.com/topic/86148-include-url-and-memory/#findComment-440543 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.