title: Calling function or script on another server and receiving response
body: <p>What I essentially want to do is to be able to call a function or script on another server using PHP and receive a response. Let me set up an example:</p>
  
  <p>On my web application, I have a page, and I need to send some data to the server, have the server do some work and then return a response.</p>
  
  <p>Web application:</p>
  
  <pre><code>&lt;?php
  
  // call server script, sending it for example a string, "testString", then wait for a response
  
  ?&gt;
  </code></pre>
  
  <p>Server script:</p>
  
  <pre><code>&lt;?php
  
  // get the string "testString", so some work on it and return it, displaying it on the web app
  
  ?&gt;
  </code></pre>
  
  <p>I'm not looking for someone to complete this for me, just to head me in the right direction. I've read that cURL can be useful for this, but have yet to be able to get any examples to work for me, such as these ones:</p>
  
  <p><a href="http://www.jonasjohn.de/snippets/php/curl-example.htm" rel="nofollow noreferrer">http://www.jonasjohn.de/snippets/php/curl-example.htm</a></p>
  
  <p><a href="https://stackoverflow.com/questions/6516902/how-to-get-response-using-curl-in-php">How to get response using cURL in PHP</a></p>
  
  <p>So what's an ideal route to head in to solve my problem?</p>