Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't read response headers remotely

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
shongale



Joined: 10 Jan 2011
Posts: 14

PostPosted: Sun Jul 10, 2011 3:45 pm    Post subject: Can't read response headers remotely Reply with quote

I am sending the request 'http://SERVER:PORT/status.xsl?mount=/MOUNTNAME
Internally the SERVER address is 10.1.10.174
Externally the SERVER address is 75.145.75.238

Internally I get return values from status.xsl for that mountname.

Externally it returns the following error message.
"Warning: get_headers(http://75.145.75.238:8000/MOUNTNAME) [function.get-headers]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in test.php on line 9"

Can anyone help please? I need to be able to access status.xsl from anywhere.
Thanks in advance!
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Jul 10, 2011 5:56 pm    Post subject: Reply with quote

that sounds like a routing issue, a tcp connection not be made from the external IP. could be a firewall dropping the connection leaving it to timeout.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shongale



Joined: 10 Jan 2011
Posts: 14

PostPosted: Sun Jul 10, 2011 6:25 pm    Post subject: Can't read response headers remotely Reply with quote

Karl nice to hear from ya.
I have no firewall. Simply port forwarding to a 1 computer using port 8000 configured at my router. No firewall and no SeLinux.
So any suggestions I'm willing to try.
Once again thanks.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun Jul 10, 2011 7:21 pm    Post subject: Reply with quote

I tried the status.xsl request here using one of your mountpoints and it works as expected. I don't know why your php would report an error with a different request, maybe it is trying to do something else?.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shongale



Joined: 10 Jan 2011
Posts: 14

PostPosted: Mon Jul 11, 2011 1:20 pm    Post subject: Reply with quote

I'm a little mystified. It works perfectly locally but not remotely.
You didn't have any of my mount points. I didn't post any.

Here's the code, it's pretty standard.
Code:
<?php
// configurations
$server = 'http://75.145.75.238:8000';            //url to your icecast server, with "http://", without the ending "/"
//$server = 'http://10.1.10.174:8000';            //url to your icecast server, with "http://", without the ending "/"
$mount= '/Radio_Memphis';                             //your radio's mount point, with the leading "/"

function getStreamStatus($server, $mount)
{
    $header = get_headers($server.$mount);
    if($header[0] == 'HTTP/1.0 200 OK')
    {
        return 'On Air';
    }
    else
    {
        return  'Off Air';
    }
}

function getStreamInfo($server, $mount)
{
    $output = file_get_contents($server.'/status.xsl?mount='.$mount);
    $temp_array = array();
    $search_for = "<td\s[^>]*class=\"streamdata\">(.*)<\/td>";
    $search_td = array('<td class="streamdata">','</td>');

    if(preg_match_all("/$search_for/siU",$output,$matches))
    {
        foreach($matches[0] as $match)
        {
            $to_push = str_replace($search_td,'',$match);
            $to_push = trim($to_push);
            array_push($temp_array,$to_push);
        }
    }
                 
    $stream_info['title'] = $temp_array[0];
    $stream_info['description'] = $temp_array[1];
    $stream_info['content_type'] = $temp_array[2];
    $stream_info['mount_start'] = $temp_array[3];
    $stream_info['bit_rate'] = $temp_array[4];
    $stream_info['listeners'] = $temp_array[5];
    $stream_info['peak_listeners'] = $temp_array[6];
    $stream_info['genre'] = $temp_array[7];
    $stream_info['url'] = $temp_array[8];
    $stream_info['artist_song'] = $temp_array[9];
    $x = explode(" - ",$temp_array[9]);
    $stream_info['artist'] = $x[0];
    $stream_info['song'] = $x[1];
    return $stream_info;
}

$status = getStreamStatus($server, $mount);
if($status == 'On Air')
{
    $stream_info = getStreamInfo($server, $mount);

    // This is displayed on your page
    echo '<font size="+1"><B>';
    echo 'Radio Memphis is '.$status.'<br>';
    echo 'Currently Playing:<br>Artist: '.$stream_info['artist'].'<br>Song: '.$stream_info['song'];
    echo '</B></font>';
}
?>

I use this file response.php with jQuery and Ajax to put the info on the web page. See http://3-gen.net
I will try the firewall but I don't normally use them. The firewall in my router is normally enough. I have no problem connecting to any of the streams.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Mon Jul 11, 2011 1:45 pm    Post subject: Reply with quote

I used that mountpoint when I tried before, it was present on the status xsl page. Just tried running that php here unchanged and this is the result

<font size="+1"><B>Radio Memphis is On Air<br>Currently Playing:<br>Artist: Victoria Falls<br>Song: Can I Wait</B></font>

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shongale



Joined: 10 Jan 2011
Posts: 14

PostPosted: Mon Jul 11, 2011 4:55 pm    Post subject: Reply with quote

Aaaaargggghhhh tear my hair out. I don't know why I can't access status.xsl remotely. I even tried it with the format
http://USERNAME:PASSWORD@75.145.75.238:8000/admin/listclients.xsl?mount=/Radio_Memphis
I am at a total loss.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Mon Jul 11, 2011 6:21 pm    Post subject: Reply with quote

you are not saying what actually occurs though, are you getting a connection? are you getting any response headers. These are key points to check for when finding out what is happening. If the problem is at the connection phase then it will be something specific to where ever you are connecting from. As I said the connection works from my own box.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shongale



Joined: 10 Jan 2011
Posts: 14

PostPosted: Tue Jul 12, 2011 11:57 am    Post subject: Reply with quote

That's wild. You are the only remote site that works. I tried it at 2 others and no go. I also cannot read any remote headers from my servers. Only locally.
Once again thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber