PHP Curl

User 138572 Photo


Registered User
5 posts

i tried to use a Curl script with the HTML element, but its not working, my provider sayes both PHP and Curl is supported.
I have change the adress to myradiostream.

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "s36.myradiostream.com:XXXXX/7.html");
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
$data = curl_exec($ch);
curl_close($ch);
$data = str_replace('</body></html>', "", $data);
$split = explode(',', $data);
if (empty($split[6])) {
$title = "The current song is not available ";
} else {
$count = count($split);
$i = "6";
while($i<=$count) {
if ($i > 6) {
$title .= "," . $split[$i];
} else {
$title .= $split[$i];
}
$i++;
}
}
$title = substr($title, 0, -1);
echo $title;
?>
User 187934 Photo


Senior Advisor
18,159 posts

Hi Einar,
What type of errors are you seeing?
Do you have your server setup to parse php within html?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

Here's my S-Drive site with
examples of what can be accomplished in VSD.
http://progrower.coffeecup.com/
Here's my CoffeeCup SCCP Shop with examples of what can be done.
http://progrower.coffeecup.com/shop/
This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personnel site used for testing and as an easy way to share photos.(RLM imported to RSD)
http://ericrohloff.com
http://ericrohloff.com/property/

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.