Hari Kunamneni • over 14 years ago
Given PHP smaple does not seem to work
sample code used as given in the sample:
<?phpinclude "DOLDataSDK.php";echo "hello";//Instantiate DOL Data context object//This object stores the API information required to make requests$context = new DOLDataContext('http://api.dol.gov', '7785c426-3a7e-4851-aca6-9a25d698126e', 'Prasad123#'); //Instantiate new request object. Pass the context that contains all the API key info$request = new DOLDataRequest $context;//API you want to fetch data from//$method = "FORMS/Agencies";//Build Array arguments//Example to retrieve top 10 records and just get one field. //$arguments = Array('top' => '10', 'select' => 'AgencyName');//echo $arguments//Make API call//$results = $request->callAPI($method, $arguments);//if (is_string($results)) {//handle error//} else {//handle success//}?>
Error Generated:
( ! ) Parse error: syntax error, unexpected T_VARIABLE in C:\angular\angular-phonecat\app\phpTest\dolphptest.php on line 11
Comments are closed.

1 comment
Mike Pulsifer Manager • over 14 years ago
Hari,
Thank you for taking an interest in using our API.
Please make sure you have the DOLDataSDK.php file in the same folder as your php page.
Also, we have retested the PHP sample and have confirmed it is working. However, we did notice that you are missing some parenthesis here:
$request = new DOLDataRequest $context;
could you please change it to:
$request = new DOLDataRequest($context);
Could you please review your syntax and re-run your application and let us know if you continue to have issues?