hppp Serveur@home | Salut
Je suis en trains de me faire une interface en php pour exécuter des commande sur mon serveur asterisk.
voilà le script:
Code :
- <?php
- $IP_server= "172.20.2.1";
- $Port_Manager="xxxx";
- $Manager_Login= "admin";
- $Manager_Password= "xxxxx";
- //Please don't change anything after this line
- $socket = fsockopen("$IP_server", "$Port_Manager", $errno, $errstr, $timeout);
- fputs($socket, "Action: Login\r\n" );
- fputs($socket, "UserName: ".$Manager_Login."\r\n" );
- fputs($socket, "Secret: ".$Manager_Password."\r\n\r\n" );
- $ext = $_GET['ext'];
- fputs($socket, "Action: SIPShowPeer\r\n" );
- fputs($socket, "Peer: ovh\r\n\r\n" );
- fputs($socket, "Action: Logoff\r\n\r\n" );
- while (!feof($socket))
- {
- $wrets .= fgets($socket,8192);
- $show = preg_match("^Address-IP: [0-9]{1,3}+\.[0-9]{1,3}+\.[0-9]{1,3}+\.[0-9]{1,3}^", $wrets, $matches);
- $stat = preg_match("^SIP-Useragent: .{1,35}^", $wrets, $status);
- }
- if ($show=="0" )
- {
- echo "<font color=\"#FF0000\">NOT-ONLINE</font>";
- }
- else
- {
- echo "<font color=\"#006600\">ON-LINE</p> ",(print_r( implode(" ", $matches),1)),"</font></p>";
- echo "<font color=\"#006600\">",(print_r( implode(" ", $status),0)),"</font></p>";
- //echo $wrets;
- }
- fclose($socket);
- ?>
|
Mais voila les erreurs qu'il me fait:
Code :
- Warning: fsockopen() [function.fsockopen]: unable to connect to 172.20.2.1:xxxx (Connection timed out) in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 9
- Warning: fputs(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 10
- Warning: fputs(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 11
- Warning: fputs(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 12
- Warning: fputs(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 17
- Warning: fputs(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 18
- Warning: fputs(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 19
- Warning: feof(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 21
- Warning: fgets(): supplied argument is not a valid stream resource in /opt/nfs/www/henry/henpier/site/onduleur/appel2.php on line 23
|
J'ai essayé de cherché le problème mais je ne suis pas arrivé. SI vous le savez merci d'avance. |