Skip to content

Instantly share code, notes, and snippets.

@Mombuyish
Created November 17, 2017 16:57
Show Gist options
  • Save Mombuyish/6e39f5b96c198245c23be999489def00 to your computer and use it in GitHub Desktop.
Save Mombuyish/6e39f5b96c198245c23be999489def00 to your computer and use it in GitHub Desktop.
<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://api.imgur.com/3/image');
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Client-ID ' . 'app_id'));
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, base64_encode(file_get_contents($request->file('image')->path())));
$response = curl_exec($curl);
curl_close($curl);
return response()->json(json_decode(($response)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment