Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/03/2012, 11:46
Cairam
 
Fecha de Ingreso: febrero-2012
Mensajes: 21
Antigüedad: 12 años, 2 meses
Puntos: 0
Mensaje Problema con Socket de prueba

Hola

Tengo instalado un servidor WAMP

y estoy probando el siguiente codigo php

<?php
$fp = fsockopen ( "localhost" , 80 , $errno , $errstr , 30 );
if (! $fp ) {
echo " $errstr ( $errno )<br />\n" ;
} else {
$out = "GET / HTTP/1.1\r\n" ;
$out .= "Host: www.example.com\r\n" ;
$out .= "Connection: Close\r\n\r\n" ;
fwrite ( $fp , $out );
while (! feof ( $fp )) {
echo fgets ( $fp , 128 );
}
fclose ( $fp );
}
?>


y me da el siguiente error

Warning: fsockopen() [function.fsockopen]: unable to connect to localhost:80 (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 C:\wamp\www\prueba_socket_dos.php on line 2
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. ( 10060 )


He realizado varias pruebas, pero no entiendo, alguien me puede ayudar?

De hecho en otra pc, si funciona el codigo, estoy casi segura que es algo en la configuracion, pero no lo identifico