title: PHP - run GET curl, get result
body: <p>I wanna run a GET curl in php A to get data from php B.</p>
  
  <p>This is an example in php A (I got from here <a href="http://support.qualityunit.com/061754-How-to-make-REST-calls-in-PHP" rel="nofollow noreferrer">http://support.qualityunit.com/061754-How-to-make-REST-calls-in-PHP</a>)</p>
  
  <pre><code>//next example will recieve all messages for specific conversation
  $service_url = 'http://localhost/test/getFrom.php?id=1';
  $curl = curl_init($service_url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  $curl_response = curl_exec($curl);
  if ($curl_response === false) {
      $info = curl_getinfo($curl);
      curl_close($curl);
      die('error occured during curl exec. Additioanl info: ' . var_export($info));
  }
  curl_close($curl);
  $decoded = json_decode($curl_response);
  if (isset($decoded-&gt;response-&gt;status) &amp;&amp; $decoded-&gt;response-&gt;status == 'ERROR') {
      die('error occured: ' . $decoded-&gt;response-&gt;errormessage);
  }
  echo 'response ok!';
  var_export($decoded-&gt;response);
  </code></pre>
  
  <p>And I tried this example as well (<a href="https://stackoverflow.com/questions/7516863/trying-to-use-curl-to-do-a-get-value-being-sent-is-allows-null">Trying to use curl to do a GET, value being sent is allows null</a>) </p>
  
  <p>In php B.
  It will get the ID, run some script and will generate an ARRAY.</p>
  
  <p>I want to get this ARRAY from B to A. </p>
  
  <p>B will run only when A request GET from B. </p>
  
  <p>The problem is I don't how the ARRAY can pass from B to A. </p>
  
  <p>Please give some advice THANK YOU.</p>