title: Escaping "?" in URL with PHP functions
body: <pre><code>function prepareHeader($url, $method, $ctype = null)
  {
      $accInfo = json_decode(file_get_contents(&quot;etradeAccountInfo.json&quot;), true);
      $consumerKey = $accInfo['consumerKey'];
      $consumerSecret = $accInfo['consumerSecret'];
  
      $requestInfo = json_decode(file_get_contents(&quot;etrade_oauth.json&quot;), true);
      $oauth = array(
          'oauth_consumer_key' =&gt; $consumerKey,
          'oauth_nonce' =&gt; md5(mt_rand()),
          'oauth_signature_method' =&gt; 'HMAC-SHA1',
          'oauth_timestamp' =&gt; time(),
          'oauth_version' =&gt; '1.0',
          'oauth_token' =&gt; $requestInfo['oauth_token']
      );
      $base_info = buildBaseString($url, $method, $oauth);
      $composite_key = rawurlencode($consumerSecret) . '&amp;' . rawurlencode($requestInfo['oauth_token_secret']);
      $oauth_signature = base64_encode(hash_hmac('sha1', $base_info, $composite_key, true));
      $oauth['oauth_signature'] = $oauth_signature;
      $header = array(buildAuthorizationHeader($oauth), 'Expect:', 'Accept:application/json', $ctype);
      return $header;
  }
  
  $count100 = '?count=100';
  $urlFragment = &quot;accounts/$accountIdKey/portfolio&quot;;
  $URL = $url . $urlFragment . $count100;
  
  
    $header = prepareHeader($URL, 'GET');
  
          // Prepare new cURL resource
          $options = array(
              CURLOPT_HTTPHEADER =&gt; $header,
              CURLOPT_HEADER =&gt; false,
              CURLOPT_URL =&gt; $URL,
              CURLOPT_RETURNTRANSFER =&gt; true,
              CURLOPT_SSL_VERIFYPEER =&gt; false,
              CURLOPT_CUSTOMREQUEST =&gt; &quot;GET&quot;
      
          );
  
          $feed = curl_init();
          curl_setopt_array($feed, $options);
          $response = curl_exec($feed);
          // curl_close($feed);
           print_r($response);
  </code></pre>
  <p>I'm trying to PHP CURL the following URL but it wouldn't work - it skipped the entire function above because of the <code>?count=100</code> if I were to take it out then it works fine... Here's the url I'm trying to curl it with <code>https://api.etrade.com/v1/accounts/asdfsd34545/portfolio?count=100</code></p>
  <p>any kind of help on this is greatly appreciated!</p>