A connection to the API of a REDCap instance. This class provides a low-level
interface to the REDCap API, and is primarily intended for internal use by PHPCap,
but could be used directly by a user to access REDCap functionality not provided
by PHPCap.
Methods summary
public
|
+/-
__construct( string $url, boolean $sslVerify = false, string $caCertificateFile = '', IU\PHPCap\ErrorHandlerInterface $errorHandler = null )
Constructor that creates a REDCap API connection for the specified URL, with the
specified settings.
Constructor that creates a REDCap API connection for the specified URL, with the
specified settings.
Parameters
- $url
- the URL for the API of the REDCap site that you want to connect to.
- $sslVerify
indicates if verification should be done for the SSL
connection to REDCap. Setting this to false is not secure.
- $caCertificateFile
the CA (Certificate Authority) certificate file used for veriying the REDCap site's
SSL certificate (i.e., for verifying that the REDCap site that is
connected to is the one specified).
- $errorHandler
- the error handler for the connection.
Throws
Implementation of
|
public
|
+/-
__destruct( )
Closes the cURL handle (if it is set).
Closes the cURL handle (if it is set).
Implementation of
|
public
string
|
+/-
call( mixed $data )
Makes a call to REDCap's API and returns the results.
Makes a call to REDCap's API and returns the results.
Parameters
Returns
string the response returned by the REDCap API for the specified call data.
See the REDCap API documentation for more information.
Throws
Implementation of
|
public
string
|
+/-
callWithArray( $dataArray )
Calls REDCap's API using a with a correctly formatted string version
of the specified array and returns the results.
Calls REDCap's API using a with a correctly formatted string version
of the specified array and returns the results.
Parameters
- $dataArray
the array of data that is converted to a
string and then passed to the REDCap API.
Returns
string the response returned by the REDCap API for the specified call data.
See the REDCap API documentation for more information.
Throws
Implementation of
|
public
array
|
+/-
getCallInfo( )
Returns call information for the most recent call.
Returns call information for the most recent call.
Returns
array an associative array of values of call information for the most recent call made.
Throws
See
Implementation of
|
public
|
+/-
getErrorHandler( )
Gets the error handler for the connection.
Gets the error handler for the connection.
Implementation of
|
public
|
|
public
|
+/-
getUrl( )
Gets the URL of the connection.
Gets the URL of the connection.
return string the URL of the connection.
Implementation of
|
public
|
+/-
setUrl( string $url )
Sets the URL of the connection.
Sets the URL of the connection.
Parameters
- $url
- the URL of the connection.
Implementation of
|
public
boolean
|
+/-
getSslVerify( )
Gets the status of SSL verification for the connection.
Gets the status of SSL verification for the connection.
Returns
boolean true if SSL verification is enabled, and false otherwise.
Implementation of
|
public
|
+/-
setSslVerify( boolean $sslVerify )
Sets SSL verification for the connection.
Sets SSL verification for the connection.
Parameters
- $sslVerify
if this is true, then the site being connected to will
have its SSL certificate verified.
Implementation of
|
public
|
|
public
|
|
public
integer
|
+/-
getTimeoutInSeconds( )
Gets the timeout in seconds for calls to the connection.
Gets the timeout in seconds for calls to the connection.
Returns
integer timeout in seconds for calls to connection.
Implementation of
|
public
|
+/-
setTimeoutInSeconds( $timeoutInSeconds )
Sets the timeout in seconds for calls to the connection.
Sets the timeout in seconds for calls to the connection.
Parameters
- $timeoutInSeconds
- in seconds for call to connection.
Implementation of
|
public
integer
|
+/-
getConnectionTimeoutInSeconds( )
Gets the timeout for time to make a connection in seconds.
Gets the timeout for time to make a connection in seconds.
Returns
integer connection timeout in seconds.
Implementation of
|
public
|
+/-
setConnectionTimeoutInSeconds( integer $connectionTimeoutInSeconds )
Sets the timeout for time to make a connection in seconds.
Sets the timeout for time to make a connection in seconds.
Parameters
- $connectionTimeoutInSeconds
- timeout in seconds.
Implementation of
|
public
boolean
|
+/-
setCurlOption( integer $option, mixed $value )
Sets the specified cURL option to the specified value.
Sets the specified cURL option to the specified value.
Parameters
- $option
- the cURL option that is being set.
- $value
- the value that the cURL option is being set to.
Returns
boolean Returns true on success and false on failure.
See
|
public
mixed
|
+/-
getCurlOption( integer $option )
Gets the value for the specified cURL option number.
Gets the value for the specified cURL option number.
Parameters
- $option
- cURL option number.
Returns
mixed if the specified option has a value that has been set in the code,
then the value is returned. If no value was set, then null is returned.
Note that the cURL CURLOPT_POSTFIELDS option value is not saved,
because it is reset with every call and can can be very large.
As a result, null will always be returned for this cURL option.
See
|
public
|
|