PHP
PHP Sample Application
The sample application below is available as a resource for building PHP applications using the EDS API.
Source code (EBSCO GitHub Repository)
Response Structure Updates
If you are using the sample source code from the demos, please note that there are areas where the absence of a nil element will cause it to throw a ‘silent’ error.
In EBSCOResponse.php, buildRecords() method:
$result['PDF'] = $record->FullText->Links->Link->Type ? (string) $record->FullText->Links->Link->Type : ;
In EBSCOResponse.php, buildRetrieve() method:
$result['PDF'] = $record->FullText->Links->Link->Type ? (string) $record->FullText->Links->Link->Type : ;
$result['pdflink'] = $record->FullText->Links->Link->Url ? (string) $record->FullText->Links->Link->Url : ;
The code is looking for the object “Type” or “URL”, but that object and its parent no longer exist. This results in a silent error.
This error will not break the application. However, you may want to make sure that the PHP server is suppressing the error and not displaying it on the user interface. In the PHP.ini file, look for “display_errors” and set the value to ‘Off’.
PHP Publication Finder Sample Application
The Publication Finder sample app is basic PHP code which uses publication finder to search for publications within collections. This application is intended for demonstration purposes.
The app contains an alphabetical browse and a custom search for more specific terms. Both of them are shown on the main page and used to query the Publication Finder API with prefix JN added at the beginning of the search term.
Source Code
EBSCO GitHub repository: https://github.com/ebsco/Publication-Finder-API-Sample
How to Use
Copy the contents of the provided source to the root of your server and setup the Config.xml. Within this file, you will only need to enter your credentials using the following tags:
<EDSUserID>Enter your User ID</EDSUserID>
<EDSPassword>Enter your Password</EDSPassword>
<EDSProfile>Enter your API profile</EDSProfile>
Your User ID and Password must be associated with the CustID and Group where the API Profile is located. You do not need to change anything else.
Publication Search
A-to-Z Browse
An alphabetical menu is available. When clicking one of the letters, a sub-menu will appear as shown in the image below.
You can click any of the links within the sub-menu and a new search will be launched automatically. This search option is also available in the results page.
Custom Search
Custom search is only in the search page. Below the alphabetical menu, there is a search box that allows you to enter a search term. Two options can be selected:
- Publication title begins with
- Publication title contains
Results
This sample app parses the XML retrieved by the Publication Finder API and shows the results. The title of each result is a link that opens the corresponding detailed record in EDS.
Updated 5 months ago