// 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');