title: Proper encode data before sending to url with urlencode
body: <p>I was sending data to URL and it gives me this error</p>
  
  <blockquote>
    <p>failed! HTTP/1.1 505 HTTP Version Not Supported in</p>
  </blockquote>
  
  <p>my code:</p>
  
  <pre><code>&lt;?php 
  $pickup_time= '2016-8-20 11:11';
  $city = 'Islamabad';
  
  $pickup_address= 'aaa';
  $dropoff_address = 'bbb';
  $pickup_area= 'Street 1, F-8, Islamabad, Islamabad Capital Territory, Pakistan';
  $drop_area= 'Karachi, Sindh, Pakistan';
  $multi_areas = 'Lake View Park, Islamabad, Islamabad Capital Territory, Pakistan';
  $description = 'nill';
  
  $booking_fare = '30590';
  $deadmile_distance = 'nill';
  $actual_distance = '1519';
  $payment_method = '1';
  
  $pickup_area = preg_replace('/[.,]/', '', $pickup_area);// remove commas from string
  $drop_area = preg_replace('/[.,]/', '', $drop_area);// remove commas from string
  $multi_areas = preg_replace('/[.,]/', '', $multi_areas);// remove commas from string
  
  
  $jsonData = file_get_contents("https://daewoocab-test.herokuapp.com/api/v1/customer/923331524145/booking/new?token=6ab676ddd7bf00101408ea3a27fdbb8ad22e9dcdf2faafdcd2ef0efc1509d463&amp;booking[pickup_time]=$pickup_time&amp;booking[city]=$city&amp;booking[pickup_address]=$pickup_address&amp;booking[drop_address]=$dropoff_address&amp;booking[pickup_area]=$pickup_area&amp;booking[drop_area]=$drop_area&amp;booking[multi_areas]=($multi_areas)&amp;booking[description]=$description&amp;booking[booking_fare]=$booking_fare&amp;booking[deadmile_distance]=$deadmile_distance&amp;booking[actual_distance]=$actual_distance&amp;booking[payment_method]=$payment_method");
  $json = json_decode($jsonData,true);
  echo $json['bookings']['id'];
  ?&gt;
  </code></pre>
  
  <p>But after searching, I used urlencode with my strings to remove the spaces and now my code is :</p>
  
  <pre><code>$jsonData = file_get_contents("https://daewoocab-test.herokuapp.com/api/v1/customer/923331524145/booking/new?token=6ab676ddd7bf00101408ea3a27fdbb8ad22e9dcdf2faafdcd2ef0efc1509d463&amp;booking[pickup_time]=" . urlencode($pickup_time)"&amp;booking[city]=$city&amp;booking[pickup_address]=$pickup_address&amp;booking[drop_address]=$dropoff_address&amp;booking[pickup_area]=". urlencode($pickup_area)"&amp;booking[drop_area]=". urlencode($drop_area)"&amp;booking[multi_areas]=(" . urlencode($multi_areas)")&amp;booking[description]=$description&amp;booking[booking_fare]=$booking_fare&amp;booking[deadmile_distance]=$deadmile_distance&amp;booking[actual_distance]=$actual_distance&amp;booking[payment_method]=$payment_method
  </code></pre>
  
  <p>Still it gives me the syntax error, I have checked it like 100 times but not found any syntax error. Am i doing something wrong here ?</p>