retrieve data from api
<p>I am Passing  array of parameter to api and Trying to return  same Array Elements in json format</p>

<p>I have created very simple 2 pages </p>

<p>1.
 For sending array with api</p>

<pre><code>&lt;?php
$array['Phone'] =  123456;
$array['name'] = 'name1';
$array['email'] = 'testemail';
$array['password'] = 'password';
$array['api_key'] = $api_key;
$array['referral_code'] = 'kk';

$url = "http://getsjobs.esy.es/registerapi.php?Array[]=$array";

$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, 4);
$json = curl_exec($ch);
if(!$json) {
    echo curl_error($ch);
}

curl_close($ch);

$data = json_decode($json,true);


foreach ($data as $item) {

    echo $data;

}
?&gt;php 
</code></pre>

<p>and </p>

<ol start="2">
<li><p>Trying to return the same array as JSON Format (For testing )</p>

<pre><code>&lt;?PHP

if(isset($_GET['Array[]'])) {

$_Phone= $array['Phone'];
$_name = $array['name'];
$_email = $array['email'];
$_password = $array['password'];
$api_key = md5(uniqid(rand(), true));
$_referral_code = $array['referral_code'];


$posts = $_GET['Array[]'];

header('Content-type: application/json');


}


?&gt;
</code></pre></li>
</ol>

<p>But SomeHow Json data is not able to fetch array from api .I have Tried to create the code carefully by following examples from here , Still I think something is missing here .</p>

<p>just need one Hint what could be reason that array is not passing or recieving ?Any help would be apprecited</p>