Ricky February 2016

Error 406 while querying a Socrata dataset

I'm trying to create a site in php whereby a person can check if a business is in a list of businesses. That list is here.

I'm getting "Error 406 from server", which I believe means I asked for the data in an unacceptable format. The page first presents a form for a user. They write in the businesses name which is posted to this piece of code as $_POST["name"].

I'm not sure what I'm doing wrong, I mostly tried to follow the example called index.php in the Socrata php library. I did implement require(socrata.php);

$view_uid = "mqet-2q6r";
$root_url = "https://data.southbendin.gov/Business/South-Bend-Businesses-Open-to-All-Customers/";
$socrata = new Socrata($root_url);

$params = array("\$query" => "SELECT * WHERE business_name = " . $_POST["name"]);

$response = $socrata->get("$view_uid", $params);


chrismetcalf February 2016

Close, but not quite!

For your $root_url, you actually want to use the domain for South Bend's data portal, https://data.southbendin.gov: https://github.com/socrata/soda-php

For more details on that API, you should read its API documentation: https://dev.socrata.com/foundry/data.southbendin.gov/hyxr-yvey

Post Status

Asked in February 2016
Viewed 1,633 times
Voted 10
Answered 1 times


Leave an answer