0
Hello, I have a code in PHP, and inside it I would like to pull information.
@$host = "23.98.102.87";
@$port = "9498";
Where has the number s is where I wanted to pull the data, I’ve already made the select, but I wonder, how I could pull information from the database within a php. For example, I have a database, where you already have this IP and number, and I wanted it to come from there, not that I change manually.
Well, I have a huge code, and it makes mistakes using the echo.
Code:
<?php
$id = $_GET['id'];
$radios1_3 = mysql_query("SELECT * FROM radios ORDER BY id DESC LIMIT 300") or die(mysql_error());
$linha = mysql_fetch_array($radios1_3);
echo "
@$host = " . $linha["sc"] . ";
@$port = " . $linha["sc2"] . ";
@$listenlink = 'http://23.238.135.80:9998/listen.pls'; //make link to stream
@$fp = fsockopen($host, $port); //open connection
if(!$fp) {
@$success=2; //se-t if no connection
}
if(@$success!=2){ //if connection
@fputs($fp,"GET /index.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html
while(!feof($fp)) {
@$pg .= fgets($fp, 1000);
}
@fclose($fp); //close connection
@$paage = ereg_replace(".*<font class=default>Stream Title: </font></td><td><font class=default><b>", "", $pg); //extract data
@$paage = ereg_replace("</b></td></tr><tr><td width=100 nowrap>.*", "", $paage); //extract data
@$pge = ereg_replace(".*<font class=default>Stream Genre: </font></td><td><font class=default><b>", "", $pg); //extract data
@$pge = ereg_replace("</b></td></tr><tr><td width=100 nowrap>.*", "", $pge); //extract data
@$pe = ereg_replace(".*<font class=default>Stream Genre: </font></td><td><font class=default><b>", "", $pg); //extract data
@$pe = ereg_replace("</b></td></tr><tr><td width=100 nowrap>.*", "", $pe); //extract data
@$musica = ereg_replace(".*com:<font class=default>Current Song: </font></td><td><font class=default><b>", "", $pg); //extract data
@$musica = ereg_replace("</b></td></tr></table>.*", "", $musica); //extract data
@$numbers = explode(",",$paage); //extract data
@$servertitle=$numbers[0]; //set variable
@$connected=$numbers[4]; //set variable
}
@$fp2 = fsockopen("$host", $port); //open connection
if(!$fp2) {
@$success2=2; //se-t if no connection
}
if(@$success2!=2){ //if connection
fputs($fp2,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n"); //get 7.html
while(!feof($fp2)) {
@$pg2 .= fgets($fp2, 1000);
}
fclose($fp2); //close connection
@$pag = ereg_replace(".*<body>", "", $pg2); //extract data
@$pag = ereg_replace("</body>.*", ",", $pag); //extract data
@$numbers = explode(",",$pag); //extract data
$currentlisteners=$numbers[0]; //set variable
}
// ATUALIZADOR
if(@$_GET['ver'] == "dj"){
echo"$paage";
}
if(@$_GET['ver'] == "ouvintes"){
echo $currentlisteners;
}
if(@$_GET['ver'] == "musica"){
echo "$musica";
}
if(@$_GET['ver'] == "programa"){
echo"$pge";
}
if(@$_GET['ver'] == "imgloc"){
echo'<div id="boneco" style="background:url(https://www.habbo.com.br/habbo-imaging/avatarimage?img_format=gif&user='.$paage.'&action=std&direction=2&head_direction=2&gesture=spk&size=b);"></div>';
}
";
// ATUALIZADOR
?>
What error appears? or what does not happen?
– rray
http://prntscr.com/7lrnbi
– Paulo Cavalcante
Only this error appears? Which is the line 14, could evidence it.
– rray
Yeah, when I erase the line from that bug, it’s still on the same line, even the underside replacing.
– Paulo Cavalcante
pq needs the
echo
, precise separates instructions from text output.– rray