title: Getting 400 Bad Request in cUrl - PHP
body: <p>I am running the following code and getting this error:</p>
  
  <blockquote>
    <p>Bad Request</p>
    
    <p>Your browser sent a request that this server could not understand.</p>
    
    <p>Additionally, a 400 Bad Request error was encountered while trying to
    use an ErrorDocument to handle the request.</p>
  </blockquote>
  
  <pre><code>    &lt;?php
        $phone = "1236547895";
        $message = 'Dear '.$firstname.' '.$lastname.',
  
  Your invoice (#'.$invoiceid.') is successfully paid on '.$datepaid.' at Hostomy. Thank you for choosing us.
  
  Regards,
  Hostomy
  ';
        $url = "https://www.example.com/file.php?phone=".$phone."&amp;message=".$message."";
        $ch = curl_init();
        $timeout = 10;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
      ?&gt;
  </code></pre>