egturnkey Posted October 3, 2010 Share Posted October 3, 2010 Hello friends, if i have the following $path = "http://*site*.com"; why can't i write the following $ORGtext= file_get_contents('$path'); it works only if i write $ORGtext= file_get_contents('http://*site*.com'); but i want to put $path instead of the url at file_get_contents is it possible and if yes then how ? thank you Quote Link to comment Share on other sites More sharing options...
Yesideez Posted October 3, 2010 Share Posted October 3, 2010 If you place a variable inside single quotes you'll get the name of the variable (ie. exact text) and not the contents. Try this: $ORGtext= file_get_contents($path); You can place variables inside double quotes and get their contents - this is the difference between single and double quotes. Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted October 3, 2010 Share Posted October 3, 2010 Try the following egturnkey... $ORGtext= file_get_contents($path); Or this... $ORGtext= file_get_contents(''.$path.''); They both retrieve same data, except the first one is just using the variable as the string while the second one is concating the variable into a string. Regards, Paul. Edit* Seems we posted at the same time, use which feels more comfortable Quote Link to comment Share on other sites More sharing options...
egturnkey Posted October 3, 2010 Author Share Posted October 3, 2010 thank you both it is working now perfect Quote Link to comment 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.