Created
July 10, 2015 18:55
-
-
Save delalis/17c3c111e3b42df127ed 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
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Bearer ABCD1234etc','Content-Type: multipart/form-data; boundary=BOUNDARY')); | |
curl_setopt ($curl, CURLOPT_URL, "https://connect.squareup.com/v1/me/items/27/image"); | |
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($curl, CURLOPT_POSTFIELDS, ['image_data' => '@sites/default/files/styles/artists_page/public/artists/grant.png']); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); | |
curl_setopt($curl, CURLOPT_VERBOSE, TRUE); | |
if(!curl_exec($curl)){ | |
die('Error: "' . curl_error($curl) . '" - Code: ' . curl_errno($curl)); | |
} | |
$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