EN::005-Troubleshooting::001-Checking the hosting for possible connect to the comet server
Header: Checking the hosting for possible connect to the comet server
====== Checking the hosting for possible connect to the comet server ======
Some hosting providers have a ban on external connections, this is often found on free or very cheap hosting. Many hosters warn about restrictions at once but not everywhere.
To work with the CppComet service, your hoster needs support for working with sockets and there is no ban on external connections. These features are found in most paid hosting providers.
To check the hosting for prohibiting external connections, download this script and run it on your hosting.
"Could not create connection to app.comet-server.ru: error code:".$e1."(".$e2.")", "error" => true);
}
else
{
$str1 = "GET / HTTP/1.1\r\nHost: app.comet-server.ru\r\n\r\n";
if( fputs($f, $str1, strlen($str1) ) === false)
{
$resTest[] = Array("info" => "fputs error on app.comet-server.ru", "error" => true);
}
else
{
$tmp = fgets($f);
$resTest[] = Array("info" => "OK", "error" => false);
}
}
$f = fsockopen("googl.com", 80,$e1,$e2);
if(!$f)
{
$resTest[] = Array("info" => "Could not create a connection to googl.com: error code:".$e1."(".$e2.")", "error" => true);
}
else
{
$str1 = "GET / HTTP/1.1\r\nHost: googl.com\r\n\r\n";
if( fputs($f, $str1, strlen($str1) ) === false)
{
$resTest[] = Array("info" => "fputs error on googl.com", "error" => true);
}
else
{
$tmp = fgets($f);
$resTest[] = Array("info" => "OK", "error" => false);
}
}
$f = fsockopen("yandex.ru", 80,$e1,$e2);
if(!$f)
{
$resTest[] = Array("info" => "Failed to create connection to yandex.ru: error code:".$e1."(".$e2.")", "error" => true);
}
else
{
$str1 = "GET / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n";
if( fputs($f, $str1, strlen($str1) ) === false)
{
$resTest[] = Array("info" => "fputs error on yandex.ru", "error" => true);
}
else
{
$tmp = fgets($f);
$resTest[] = Array("info" => "OK", "error" => false);
}
}
$link = mysqli_connect("app.comet-server.ru", "15", "lPXBFPqNg3f661JcegBY0N0dPXqUBdHXqj2cHf04PZgLHxT6z55e20ozojvMRvB8", "CometQL_v1");
if(!$link)
{
$resTest[] = Array("info" => "Could not create a connection with CometQL (Using CometQL is not possible)", "error" => true);
}
else
{
$result = mysqli_query ( $link, "show status" );
if(mysqli_errno($link) != 0 && @mysqli_num_rows($result))
{
$resTest[] = Array("info" => "Error code:".mysqli_errno($link)." Error text:".mysqli_error($link)."", "error" => true);
}
else
{
$resTest[] = Array("info" => "OK", "error" => false);
}
}
?>
Hosting check
";}else{echo "";}
echo $resTest[0]["info"]."
\n";
if($resTest[1]["error"]){ echo "";}else{echo "";}
echo $resTest[1]["info"]."
\n";
if($resTest[2]["error"]){ echo "";}else{echo "";}
echo $resTest[2]["info"]."
\n";
if($resTest[4]["error"]){ echo "";}else{echo "";}
echo $resTest[3]["info"]."
\n";
?>