Apito REST API Integration with PHP Project
cURL is a PHP library and command-line tool (similar to wget) that allows you to send and receive files over HTTP and FTP. You can use proxies, pass data over SSL connections, set cookies, and even get files that are protected by a login.
Using curl
in Raw PHP Project​
note
Always remember to replace API_SECRET
of the Bearer Token and project-id
of the URL with the correct value from apito console.
Go to this page if you do not know where to find your api secrets and endpoints for your project
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.apito.io/secured/rest/project-id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: Bearer API_SECRET",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}