diff --git a/proxy.php b/proxy.php
index b16cf02..1a330c5 100755
--- a/proxy.php
+++ b/proxy.php
@@ -50,22 +50,20 @@ class Proxy {
if ($metd == 'POST') { // TODO Other with data methods
if (isset($_POST['payload'])) {
$postData = stripslashes($_POST['payload']);
- $reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
- $reqHeds .= "Connection: Close\r\n";
- $reqHeds .= "\r\n" . $postData;
} else {
- $postinfo = '';
+ $postData = '';
foreach ($_POST as $key => $value) {
- $postinfo .= $key . '=' . urlencode($value) . '&';
+ $postData .= $key . '=' . urlencode($value) . '&';
}
- $postinfo = rtrim($postinfo, '&');
- $reqHeds .= "\r\n" . $postinfo;
+ $postData = rtrim($postData, '&');
}
+ $reqHeds .= "Content-Length: ".strlen($postData)."\r\n";
+ $reqHeds .= "Connection: Close\r\n";
+ $reqHeds .= "\r\n" . $postData;
} else {
$reqHeds .= "Connection: Close\r\n\r\n";
}
-
$fp = fsockopen($serv, $port, $errno, $errstr, 30);
if (!$fp) { // TODO ErrorCode, ErrorDocument
echo "Couldn't connect to server\n
$errstr ($errno)
\n";