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! Quote Link to comment 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); Quote Link to comment 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. Quote Link to comment 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. 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.