Skip to content

Instantly share code, notes, and snippets.

@Ravenna
Created November 18, 2020 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ravenna/8972d50a8f5982593fae32ee3a1060ed to your computer and use it in GitHub Desktop.
Save Ravenna/8972d50a8f5982593fae32ee3a1060ed to your computer and use it in GitHub Desktop.
$headers = [
'Authorization' => 'Token token='.env('PSPDFKIT_TOKEN'),
'Content-Type' => "application/pdf",
//"Content-Length" => filesize($request->file('attachment'))
];
$body = [
'file' => $request->file('attachment'),
'document_id' => substr(str_shuffle($permitted_chars), 0, 10)
];
$client = new \GuzzleHttp\Client(['base_uri' => 'http://localhost:5000/api/']);
$response = $client->request('POST', 'documents', [
'debug' => true,
'headers' => $headers,
'form_params' => $body
]);
dd($response->getBody());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment