From: Roland Häder Date: Sat, 14 Aug 2010 03:47:22 +0000 (+0000) Subject: Only a question mark at the end is no valid HTTP request X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=89ac5d0f12aa675a380a93bb165ec43bbc9d1461;p=mailer.git Only a question mark at the end is no valid HTTP request --- diff --git a/inc/functions.php b/inc/functions.php index 9f3bf52436..79bb619c29 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -828,20 +828,23 @@ function sendGetRequest ($script, $data = array()) { // Add data $body = http_build_query($data, '', '&'); - // Do we have a question-mark in the script? - if (strpos($script, '?') === false) { - // No, so first char must be question mark - $body = '?' . $body; - } else { - // Ok, add & - $body = '&' . $body; - } + // There should be data, else we don't need to extend $script with $body + if (empty($body)) { + // Do we have a question-mark in the script? + if (strpos($script, '?') === false) { + // No, so first char must be question mark + $body = '?' . $body; + } else { + // Ok, add & + $body = '&' . $body; + } - // Add script data - $script .= $body; + // Add script data + $script .= $body; - // Remove trailed & to make it more conform - if (substr($script, -1, 1) == '&') $script = substr($script, 0, -1); + // Remove trailed & to make it more conform + if (substr($script, -1, 1) == '&') $script = substr($script, 0, -1); + } // END - if // Generate GET request header $request = 'GET /' . trim($script) . ' HTTP/1.1' . getConfig('HTTP_EOL');