Page 1 of 1

sending the data to another server

Posted: Sat Oct 11, 2008 4:09 pm
by Blondy
hi guys i've gt below code

Code: Select all

function post($host, $path, $data) { 
$http_response = ''; 
$content_length = strlen($data); 
$fp = fsockopen($host, 80); 
fputs($fp, "POST $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: $content_length\r\n"); 
fputs($fp, "Connection: close\r\n\r\n"); 
fputs($fp, $data); 
while (!feof($fp)) $http_response .= fgets($fp, 28); 
fclose($fp); 
return $http_response; 
} 
 
$postdata = '?foo=bar'; 
foreach($_POST as $key => $val) $postdata .= '&'.$key.'='.$val; 
 
$http_response = post('example.org', '/path/to/script.php', $postdata); 
 
I want to ask how much this posting method is secure
and how the response lenght could be?
thanks
and as a hint if you know how I code encrypt this code cause i'm gonna use this code for activating my script
thanks

Re: sending the data to another server

Posted: Sun Oct 12, 2008 9:44 am
by aditya2071990
Well paypal uses the same concept: posting data to another server, for their website payments standard buttons.

But I reckon you better use https:// connections, for encryption and stuff...

Re: sending the data to another server

Posted: Mon Oct 13, 2008 11:48 am
by Blondy
and what about response if anybody knows