Skip to content

Instantly share code, notes, and snippets.

@sagar-synergenie
Created March 30, 2018 12:17
Show Gist options
  • Save sagar-synergenie/04607ac7c0aee8d629469309a9732b3e to your computer and use it in GitHub Desktop.
Save sagar-synergenie/04607ac7c0aee8d629469309a9732b3e to your computer and use it in GitHub Desktop.
$crl = curl_init();
$post_data = array (
"front_image" => new \CURLFile('/home/vagrant/code/tokenregistration/public/favicon.png', 'image/png','testpic1'),
"back_image" => new \CURLFile('/home/vagrant/code/tokenregistration/public/favicon.png', 'image/png', 'testpic2'),
"type" => "PASSPORT",
"document_name" => 'normal curl',
"document_description" => '11',
"document_number" => '123',
"issuing_country" => 'GBR',
"issue_date" => '2010-01-01',
"expiry_date" => '2020-01-01',
'mrz_line1'=>'IDGBRDOE<<<<<<<<<<<<<<<<<<<<<<<<<<<<',
'mrz_line2'=>'N1234567890JOHN<<<<<<<<<<<<6512068F4'
);
$headr = array();
$headr[] = 'Authorization: Bearer '.$this->authToken;
curl_setopt($crl, CURLOPT_HTTPHEADER,$headr);
curl_setopt($crl, CURLOPT_POST,true);
curl_setopt($crl, CURLOPT_URL, env('SWIFTDIL_URL')."/customers/".$this->user->swiftdil_id."/documents");
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
// we are doing a POST request
curl_setopt($crl, CURLOPT_POST, 1);
// adding the post variables to the request
curl_setopt($crl, CURLOPT_POSTFIELDS, $post_data);
$rest = curl_exec($crl);
$contentType = curl_getinfo($crl, CURLINFO_CONTENT_TYPE);
curl_close($crl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment