Hi everyone,
I know absolutely nothing about any language other than PHP (and English of course).
I would like to offer the following sample script in other languages, so if there are any multi-lingual programmers here who know other languages, i would appreciate some help with a translation of the following:
PHP Code:
$host = "www.tm4b.com";
$port = "80";
$request = "user=abcdef&pass=12345";
$request_length = strlen($request);
$script = "/client/api/send.php";
$method = "POST"; //Replace with "GET" if required.
if($method=="GET") $script .= "?$request";
$header = "$method $script HTTP/1.1\r\n".
"Host: $host\r\n".
"User-Agent: HTTP/1.1\r\n".
"Content-Type: application/x-www-form-urlencoded\r\n".
"Content-Length: $request_length\r\n".
"Connection: close\r\n\r\n".
"$request\r\n";
$socket = fsockopen($host, $port, $errno, $errstr);
if ($socket)
{
fputs($socket, $header);
while(!feof($socket)) $output[] = fgets($socket); //place each element of the response into an array
fclose($socket);
}
print "<pre>";print_r($output);print "</pre>";//view the response as a whole
Thanks o ye multi-lingual ones, and please don't forget to let me know the language.
|