fsockopen() error

Asked

Viewed 225 times

1

I’m having an error in that line, and I don’t know why, I tried everything and I didn’t get it.

Error:

Warning: fsockopen() [Function.fsockopen]: Unable to connect to srvstm.com (Connection refused) in kick.php on line 39

<?php

$sql = mysql_query("SELECT * FROM dados_radio");

$ver = mysql_fetch_array($sql);

$kikar = $_POST['kikar'];

if($_POST){

    mysql_query("INSERT INTO logs_radio(usuario, ip, data) VALUES ('".$_SESSION['usuario_painel']."','".$_SERVER['REMOTE_ADDR']."','".time()."') ");

    $scfp = fsockopen($ver['ip'], $ver['porta'], &$errno, &$errstr, 10);

    if($scfp){

        fputs($scfp,"GET /admin.cgi?pass=".$ver['senha_kick']."&mode=kicksrc HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");

        while(!feof($scfp)) {

            $page .= fgets($scfp, 1000);

        }

        fclose($scfp);

    }

    echo "<script>alert('Boa sorte. Processo feito com sucesso.')</script>";

}

?>

1 answer

0

Have you used this function on this server and worked? It is likely that the directive allow_url_fopen is disabled on your server.

Put anywhere in your code and view your PHP settings and get the directive allow_url_fopen is enabled.

  • I was seeing this now that it may be disabled, hostgator usage there is a problem...

  • Would via . htaccess be possible?

  • allow_url_fopen this as (on)

  • In the error shows that this occurs on line 39 of the kick.php file, where is this content? It will be easier to see where the error is being pointed.

  • Anyway, you tried exception $scfp = @fsockopen($ver['ip'], $ver['porta'], &$errno, &$errstr, 10); ?

  • The Error is on that line there she is the 39

  • When I put the @ error did not appear but the system did not work.

  • Right. @Josimara, I didn’t notice..... seeing this line, these lines & are too much, aren’t they? Try so: $scfp = @fsockopen($ver['ip'], $ver['porta'], $errno, $errstr, 10);

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.