public static function addQueryData ($url, $parms) {
    if (is_array($parms)) {
      // construct GET data
      $payload = self::urlEncode($parms);

    } else if (null !== $parms) {
      $payload = (string) $parms;
    }
    if (!empty($payload)) {
      $parts = parse_url($url);
      if (isset($parts['query'])) {
        $parts['query'] .= "&{$payload}";
      } else {
        $parts['query'] = $payload;
      }
      $url = self::assembleUrl($parts);
    }
    return $url;
  }