Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/05/2003, 14:05
esaubl
 
Fecha de Ingreso: mayo-2003
Mensajes: 115
Antigüedad: 20 años, 10 meses
Puntos: 0
Probe y me marca un error a ver si me pueden ayudar

cluster el ejemplo lque me diste en
http://www.faqts.com/knowledge_base/...d/12039/fid/51

ya lo probe y me marca un error mira

mi codigo de mi script es este

que en si es la funcion del enlace
Código PHP:
<?
function sendToHost($host,$method,$path,$data,$useragent=0)
{
    
// Supply a default method of GET if the one passed was empty
    
if (empty($method))
        
$method 'GET';
    
$method strtoupper($method);
    
$fp fsockopen($host,80);
    if (
$method == 'GET')
        
$path .= '?' $data;
    
fputs($fp"$method $path HTTP/1.1\r\n");
    
fputs($fp"Host: $host\r\n");
    
fputs($fp"Content-type: application/x-www-form-
urlencoded\r\n"
);
    
fputs($fp"Content-length: " strlen($data) . "\r\n");
    if (
$useragent)
        
fputs($fp"User-Agent: MSIE\r\n");
    
fputs($fp"Connection: close\r\n\r\n");
    if (
$method == 'POST')
        
fputs($fp$data);

    while (!
feof($fp))
        
$buf .= fgets($fp,128);
    
fclose($fp);
    
    return 
$buf;
}
?>
<html>
<head>
<title>prueba</title>
</head>
<body>
<?
//$buffer=sendToHost('www.google.com.mx','get','/search','q=pillo');
$buffer=sendToHost('www.example.com','post','/some_script.cgi','param=First+Param&s

econd=Second+param'
);
echo 
$buffer;
?>
</body>
</html>

------------------------------------

cuando ejecuto el script me sale lo sig:

--------------------------------------------
HTTP/1.1 400 Bad Request Date: Tue, 13 May 2003 20:20:09 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) Connection: close Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 16e
Bad Request
Your browser sent a request that this server could not understand.

Request header field is missing colon separator.

urlencoded

Apache/1.3.27 Server at www.example.com Port 80
0



-----------------------------------------
Yo pienso que el error esta en la linea:
---------------------------------
Código PHP:
    fputs($fp"Content-type: application/x-www-form-
urlencoded\r\n"
); 
ya probe con el ejemplo de google y tambien me marca request ilegal

que sera