I have some troubles with a custom written API.
It happens when I do an API call, it randomly returns nothing. This is now temporary fixed by doing the same API call until something is returned.
The API calls are always the same and the code itself (SDK and API) does not throw any errors.
I'm thinking of a connection problem?
Is there anyone who has an idea how to fix this properly?
SDK Code:
function doGetRequest($request, $params = array()) {
$request = 'http://www.xxx.be/api/nl/'.$request.'?'.http_build_query($params);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $request,
));
$resp = curl_exec($curl);
curl_close($curl);
return json_decode($resp);
}//doGetRequest
API Code:
public function getCompanyIdByUserId($userId) {
$sql = '
SELECT
company_member_company_id
FROM
ka_company_members
WHERE
company_member_member_id = ?
';
return db::getValue($sql, $userId);
}//getCompanyIdByUserId
Curl_info gives me this when there's nothing returned
["url"] => string(123) "http://xxx/nl/urldata/mijn_webcasts/43?key=xxx"
["content_type"]=>
string(29) "text/html; charset=iso-8859-1"
["http_code"]=>
int(500)
["header_size"]=>
int(199)
["request_size"]=>
int(154)
["filetime"]=>
int(-1)
["ssl_verify_result"]=>
int(0)
["redirect_count"]=>
int(0)
["total_time"]=>
float(0.005005)
["namelookup_time"]=>
float(1.4E-5)
["connect_time"]=>
float(4.8E-5)
["pretransfer_time"]=>
float(7.5E-5)
["size_upload"]=>
float(0)
["size_download"]=>
float(603)
["speed_download"]=>
float(120479)
["speed_upload"]=>
float(0)
["download_content_length"]=>
float(603)
["upload_content_length"]=>
float(0)
["starttransfer_time"]=>
float(0.004986)
["redirect_time"]=>
float(0)
["redirect_url"]=>
string(0) ""
["certinfo"]=>
array(0) {
}
}