title: 400 - Bad Request in Curl
body: <p>It seems like im getting a problem when Im trying to send a request to a server in php. The http api request is something like this:</p>
  
  <p><code>http://api.ean.com/ean-services/rs/hotel/v3/avail?minorRev14&amp;apiKey=p9ycn9cxb2zp3k3gfvbf5aym&amp;cid=55505&amp;locale=en_US&amp;hotelId=122212&amp;stateProvinceCode=%20NV%C2%A4cyCode=USD&amp;arrivalDate=12/27/2012&amp;departureDate=12/28/2012&amp;room1=2,&amp;room2=2,18,15&amp;room3=3,16,16,15&amp;room4=3,&amp;includeDetails=true&amp;includeRoomImages=true</code></p>
  
  <p>I have the following part of my code in php where I believe the error is occuring:   </p>
  
  <pre><code>$url = 'http://api.ean.com/ean-services/rs/hotel/v3/avail?minorRev14';
  $url .= '&amp;apiKey=p9ycn9cxb2zp3k3gfvbf5aym';
  $url .= '&amp;cid=55505';
  $url .= '&amp;locale=' . $locale . '&amp;hotelId=' . $hotelid . '&amp;stateProvinceCode=' . $state . '&amp;currencyCode=USD';
  
  $url .= '&amp;arrivalDate=' . $datefr . '&amp;departureDate=' . $dateto . '&amp;' . $details . '&amp;includeDetails=true&amp;includeRoomImages=true';
  $header = "Accept: application/json";
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  curl_setopt($ch, CURLOPT_ENCODING, "gzip");
  curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  $retValue = curl_exec($ch);
  $response = json_decode(curl_exec($ch));
  $ee       = curl_getinfo($ch);
  print_r($ee);
  
  print_r($retValue);
  </code></pre>
  
  <p>This is what I get from the print_r(curl_getinfo($ch)) statement:</p>
  
  <pre><code>Array (
      [url] =&gt; http://api.ean.com/ean-services/rs/hotel/v3/avail?minorRev14&amp;apiKey=p9ycn9cxb2zp3k3gfvbf5aym&amp;cid=55505&amp;locale=en_US&amp;hotelId=122212&amp;stateProvinceCode= NV¤cyCode=USD&amp;arrivalDate=12/27/2012&amp;departureDate=12/28/2012&amp;room1=2,&amp;room2=2,18,15&amp;room3=3,16,16,15&amp;room4=3,&amp;includeDetails=true&amp;includeRoomImages=true
      [content_type] =&gt; text/html
      [http_code] =&gt; 400
      [header_size] =&gt; 181
      [request_size] =&gt; 340
      [filetime] =&gt; -1
      [ssl_verify_result] =&gt; 0
      [redirect_count] =&gt; 0
      [total_time] =&gt; 0.469
      [namelookup_time] =&gt; 0
      [connect_time] =&gt; 0.125
      [pretransfer_time] =&gt; 0.125
      [size_upload] =&gt; 0
      [size_download] =&gt; 349
      [speed_download] =&gt; 744
      [speed_upload] =&gt; 0
      [download_content_length] =&gt; 349
      [upload_content_length] =&gt; 0
      [starttransfer_time] =&gt; 0.469
      [redirect_time] =&gt; 0
      [certinfo] =&gt; Array ( )
      [redirect_url] =&gt;
  )
  </code></pre>
  
  <p>I'm not sure what the solution can be and I have been looking at this problem for awhile now hopefully someone can help me thanks :)</p>