Inquiescent Posted December 14, 2011 Share Posted December 14, 2011 Hello guys, I currently have a problem with echoing text coming from an external site, using file_get_contents. I won't consider myself a great PhP programmer, so I'll gladly appraciate any help! The code I am using is very simple: <?php $homepage = file_get_contents('http://www.live365.com/scp/web/stn/playlist.html?station=kolonku'); echo $homepage; ?> However, the result comes out blank. If I change the link to a page made out of HTML, the code works, but the text here is a tracklist of a Live365 radio station. It changes dynamically according to what song is currently playing. I guess the code behind all this is formidable, to say the least, and I can't tell if it's made out of Javascript or PhP, or something else. Is there any way that I can solve this? I was thinking of getting the contents, then have the function updating every 10 seconds or so, so that the text is up to date most of the time. The current problem however, is getting something at all in the first place! Link to the site I want to get the contents from (it updates atomatically! The source code won't give me a clue to what's going on..): http://www.live365.com/scp/web/stn/playlist.html?station=kolonku Quote Link to comment https://forums.phpfreaks.com/topic/253137-getting-and-echoing-text-from-an-external-site-thats-not-html/ Share on other sites More sharing options...
schizoman Posted December 14, 2011 Share Posted December 14, 2011 Hi. A quick look at the source code from the link you provided shows what I think is the problem. The play list is generated by Javascript stored in separate files, and the links to those files are relative: <script type="text/javascript" src="/scripts/cookiemonster.js"></script> <script type="text/javascript" src="/scripts/ads.js"></script> <script type="text/javascript" src="/scripts/mini.js"></script> <script type="text/javascript" src="/scripts/pls.js"></script> Basically, the code you're generating is looking for the files on your server, not the Live365 server. Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/253137-getting-and-echoing-text-from-an-external-site-thats-not-html/#findComment-1297727 Share on other sites More sharing options...
Inquiescent Posted December 16, 2011 Author Share Posted December 16, 2011 Thanks! I didn't really understand why it didn't work, but that might surely be the problem. Does anyone have any idea of what to do to solve this? Quote Link to comment https://forums.phpfreaks.com/topic/253137-getting-and-echoing-text-from-an-external-site-thats-not-html/#findComment-1298424 Share on other sites More sharing options...
SergeiSS Posted December 16, 2011 Share Posted December 16, 2011 If you wish to see any page inside your page, just use IFRAME tag. Quote Link to comment https://forums.phpfreaks.com/topic/253137-getting-and-echoing-text-from-an-external-site-thats-not-html/#findComment-1298430 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.