To confirm it wasn't a problem in soda-ruby
, I did some local testing, and I was able to get the sample working just fine in PHP 7.0.3 (CLI server, freshly installed via homebrew).
The sample code did return zero results, since the dangerous dogs in that location had apparently moved on, so I updated the default location and search range. I also updated the sample to use the new SODA 2.1 endpoint for that dataset, even though the 2.0 version still works just fine for now. So make sure you grab the latest updates just so we're in sync.
The Error "0"
message is actually coming from libcurl
itself. It means that cURL had an issue even connecting with data.austintexas.gov
, which very often means that your system was unable to complete an SSL handshake because PHP/libcurl doesn't trust the certificate of the remote server. I've seen this a number of times with Austin's site, and often with Windows users. I suspect that is the case, especially given that you're able to access the same API via JavaScript.
The solution is to either update your root certificates or point at an external certificate authority that isn't bundled with XAMPP. I've never done that with XAMPP myself, but it seems like a solid answer: Enabling SSL Support for CURL in XAMPP
One of the proposed fixes also disables SSL verification entirely, which would be OK if you were just going to use PHP to hack around a bit and not in production. But please please don't use that workaround in production since it leaves you open to MITM attacks.