Jun 21, 2020 09:31 AM
Hello,
I’m studying Airtable API and I have problem with receiving anything with cURL in PHP. All I’m getting is NULL value. Here is my code:
function refreshCache(){
//get cURL resource
$ch = curl_init();
//set url
curl_setopt($ch, CURLOPT_URL, 'https://airtable.com/tbl5g83TtrSE0LpS0/viwcGbSmDc5FhHrHg/rec2UUOz1aQEPsuFL?api_key=MY_HIDDEN_KEY');
$out = curl_exec($ch);
curl_close($ch);
file_put_contents('cache.txt', $out);
print_r($out);
echo("<br/>");
var_dump(json_decode($out));
}
refreshCache();
I know that I should receive SOMETHING, because table and rows aren’t empty. What I’m doing wornd? Thank you!
Solved! Go to Solution.
Jun 21, 2020 12:04 PM
OK I get what’s wrong. I’ve tested it on local server with XAMPP and, when I used curl_error($ch), I get error like
error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none
Then I knew, that I should use host server, because xampp had certificate problems and I didn;t had time to solve it. How I recieved some real data with json format. And from now I think I can manage it :slightly_smiling_face:
Jun 21, 2020 12:04 PM
OK I get what’s wrong. I’ve tested it on local server with XAMPP and, when I used curl_error($ch), I get error like
error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none
Then I knew, that I should use host server, because xampp had certificate problems and I didn;t had time to solve it. How I recieved some real data with json format. And from now I think I can manage it :slightly_smiling_face: