bene.
allora ho scritto:

Codice PHP:
function sendToHost($host,$method,$path,$data,$useragent=0)
{
    
$buf '';
    
// Supply a default method of GET if the one passed was empty
    
if (empty($method)) {
        
$method 'GET';
    }
    
$method strtoupper($method);
    
    
$fp fsockopen ($host80$errno$errstr30);
    if (!
$fp) {
        
$buf.= "$errstr ($errno)
\n"
;
    } else {
   
        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;

passando per 'POST' e dove $data è:

$data = "Content-Disposition: form-data; name=\"".'pippo'."\"\r\n";
$data .= "\r\n".'valorepippo'."\r\n";

ma ottengo errore 400 Bad Request !!

come mai?