title: 400 Bad Request: The browser sent a request that this server could not understand (CURL PHP)
body: <p>im very confused, i done search my problem but not found for my solution
  i <code>got error 400 Bad Request: The browser sent a request that this server could not understand</code>  if i use the variable in my curl header.. but if i use string this working..
  this my script curl header</p>
  <pre><code>$headers = array(
     &quot;Accept: application/json&quot;,
     &quot;Connection: keep-alive&quot;,
     'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
     'Content-Type: application/json',
     &quot;cookie: &quot;.$g,
  );
  </code></pre>
  <p>so if i call the variable $g in my database like this
  <code>$g = $reslt-&gt;cookie;</code></p>
  <p>i got error</p>
  <blockquote>
  <p>400 Bad Request: The browser sent a request that this server could not
  understand</p>
  </blockquote>
  <p>but if i use the variable $g like this <code>$g= 'PHPSESSID=t07gb66oduc55n982al83a7';</code></p>
  <p>this working ...</p>
  <p>i want to ask how to get curl working if variable $g is called from my database.
  even though the contents in the database are correct , if I call</p>
  <blockquote>
  <p>echo $reslt-&gt;cookie;</p>
  </blockquote>
  <p>then the contents show like this</p>
  <blockquote>
  <p>PHPSESSID=t07gb66oduc55n982al83a7</p>
  </blockquote>