popokolok Posted January 14, 2009 Share Posted January 14, 2009 Hello, I have this code: $lol=file_get_contents('http://www.website.com/something/'print $page;); print $lol; $page should fetch a random filename from an array defined earlier in the code whenever the page is refreshed, to complete the url for file_get_contents. For example: http://www.website.com/something/spoon.html How can I make the print function to work inside the file_get_contents as shown above? Do I need to escape some characters or something? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/140819-function-inside-function/ Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 You don't need print at all, you just need to concatinate $page onto the existing string. eg; $lol=file_get_contents('http://www.website.com/something/' . $page); Link to comment https://forums.phpfreaks.com/topic/140819-function-inside-function/#findComment-737048 Share on other sites More sharing options...
trq Posted January 14, 2009 Share Posted January 14, 2009 ps: $page should fetch a random filename from an array defined earlier in the code whenever the page is refreshed, That logic will not work. Link to comment https://forums.phpfreaks.com/topic/140819-function-inside-function/#findComment-737050 Share on other sites More sharing options...
popokolok Posted January 14, 2009 Author Share Posted January 14, 2009 ps: $page should fetch a random filename from an array defined earlier in the code whenever the page is refreshed, That logic will not work. Thanks anyway, I'll work with that. Link to comment https://forums.phpfreaks.com/topic/140819-function-inside-function/#findComment-737059 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.