title: Send from client to server, to another server
body: <p>There are a few things I need help understanding. Long story short: Client has 3rd party application to handle user registration/mailing list/gift cards, it is my job to collect user data, format it in specific JSON object and send to their server. One additional requirement is to pass a username:password header encrypted with base64.</p>
  
  <p>Now, I have a PHP script which is correctly building the JSON object as per their specifications, but I am required to send the POST data to their server, an external web server, along with the mentioned HTTP user authentication header.</p>
  
  <p>So uh, what do I do? I had originally thought to send a PHP header to the client, like so:</p>
  
  <pre><code>Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
  </code></pre>
  
  <p>But that's not meant to go to the client. That is meant to go to an external server. Am I supposed to make the client send this header (using javascript)? How can PHP communicate with another server? And finally, how would I send the JSON object to that server, apparently in the same message as the authentication header?</p>