Created
April 22, 2020 19:28
-
-
Save prodhan/28299be19bdcd8d52da0c7269a8cff36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new Client(); | |
try { | |
$response = $client->request('POST', $uri, [ | |
'headers' => ['Accept' => 'application/json', 'Content-type' => 'application/json', 'Authorization' => $apikey], | |
['body'=>json_encode($myBody)], | |
'multipart' => [ | |
[ | |
'Content-type' => 'multipart/form-data', | |
'name' => 'file', | |
'contents' => $file, | |
'filename' => 'filename.jpg', | |
] | |
], | |
]); | |
} | |
catch (ClientException $e){ | |
return $e->getMessage(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment