Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Problem with recieving data with cURL

Solved
Jump to Solution
702 1
cancel
Showing results for 
Search instead for 
Did you mean: 

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!

1 Solution

Accepted Solutions

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:

See Solution in Thread

1 Reply 1

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: