1

I am working on a website for a radiostation. I can get the tracks that are playing at the moment from the following code:

<span data-widget="mcp-custom-text" data-name="NAMEOFSTATION" data-format="%nowplaying%"></span></b>

<script type="text/javascript" language="javascript" src="https://NAMESERVER.nl:2020/dist/widgets.js" defer></script>

And I got a radioplayer which shows the text that you want in it, the following code is the part where it displays the text that you want to show in the player:

            $the_link=trim($_GET['the_stream']);
    $t = new streaminfo($the_link);
    $songtitle=strip_tags($t->streamtitle);
    if (trim($songtitle)=='' || trim($songtitle)=='-') {
                $songtitle="SHOW HERE SONGTITLE";
        }
    echo trim($songtitle);
}

?>

How can I get the data of the first code on the position in the player? Because just paste the HTML code in the PHP variable doesn't work.

1
  • Anyone? Please :-) Commented Jul 25, 2021 at 17:51

1 Answer 1

1

Have you tried using HTTP client to make request to that URL? Looks like you are trying to get data from an API then display it on the screen. If so, try playing around with HTTP client, axios and such

Sign up to request clarification or add additional context in comments.

3 Comments

My knowledge of PHP etc. is just very small. I know a lot of HTML/CSS but not from PHP so what do I have to do for a HTTP client?
The material you given might not suffient for me to answer that. Typically, the radio station provides an URL which is an API, so when a authenticated device connect or access the URL, it will get a response from the server containing currently playing track (name, author, etc), it's hidden somewhere in the HTML or script file. If it's your case, this thread may solve your problem: stackoverflow.com/questions/5647461/…
The first script is displaying a realtime songtitle, the only thing i want is to put that title in the PHP-code on the position where now "SHOW HERE SONGTITLE" is written. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.