Jump to content

Getting and echoing text from an external site.. That's not HTML?


Inquiescent

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.