I am developing a REST based PHP app. For one of the API's I am internally calling another API via curl.
$service_url = 'http://'localhost/abc/api/v1/tutor/'.$entity.'?apikey='.$_SERVER['HTTP_APIKEY'];
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
echo $curl_response;
This has to pass through all the authentication again. But what happens is my authentication class prints the values for the database objects twice.
$dbObj = new SQLConnect($this->database);
$userData=$dbObj->preparedSearch("select apikey,userid from apitable where apikey=?",array("s",$apikey));
Here print_r($userData) gives 2 copies.