Skip to content

Instantly share code, notes, and snippets.

@sameerkumar18
Last active May 20, 2023 20:21
Show Gist options
  • Save sameerkumar18/27aa5c217f0842ed9ad72b86820ad203 to your computer and use it in GitHub Desktop.
Save sameerkumar18/27aa5c217f0842ed9ad72b86820ad203 to your computer and use it in GitHub Desktop.
Example to call CASParser.in APIs sending Binary File
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://portfolio-parser.api.casparser.in/v2/cams_karvy/parse',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('password' => 'yashu123','pdf_file'=> new CURLFILE(realpath('/Users/sameerkumar/Downloads/yashu123.pdf'))),
CURLOPT_HTTPHEADER => array(
'content-type: multipart/form-data',
'x-api-key: <YOUR-API-KEY>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment