PHP code example of iu-redcap / phpcap
1. Go to this page and download the library: Download iu-redcap/phpcap library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iu-redcap / phpcap example snippets
IU\PHPCap\RedCapProject;
$apiUrl = 'https://redcap.someplace.edu/api/';
$apiToken = '273424CC67263B849E41CCD2134F37C3';
$project = new RedCapProject($apiUrl, $apiToken);
# Print the project title
$projectInfo = $project->exportProjectInfo();
print "project title: ".$projectInfo['project_title']."\n";
# Print the first and last names for all records
$records = $project->exportRecords();
foreach ($records as $record) {
print $record['first_name']." ".$record['last_name']."\n";
}