Hi everybody .. I send an HTTP post request to server using zend_http_client
and fsockopen, with exactly the same parameter but why do I get different
response? below is my code :

//zend client
$post_param = array(
       'key0' => 'val0',
       'key1' => 'val1'
);
$client = new Zend_Http_Client();
$client->setUri('https://www.domain.com /cgi-bin/webscr');
$client->setMethod(Zend_Http_Client::POST);
$client->setParameterPost($post_param);
$response = $client->request();
$body = $response->getBody();
                        
                        
//fsock
$header = ""; 
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; 
$header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; 
$fp = fsockopen ('www.domain.com', 80, $errno, $errstr, 30);                    
if (!$fp) { 
        // HTTP ERROR  
} else { 
        // NO HTTP ERROR  
        fputs ($fp, $header . $req); 
        while (!feof($fp)) { 
                $res = fgets ($fp, 1024); 
        }
} 
fclose ($fp); 

echo $body .' vs '. $res // invalid vs verified

my question is why does the $body variable different than $res ? the
parameter that I am using is exactly the same?

-- 
View this message in context: 
http://n4.nabble.com/Zend-Http-Client-VS-fsockopen-tp1559069p1559069.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to