Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// construct upload url
$upload_url = '';
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, $upload_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, true);
$post = array(
'file' => '@'.$medium_local_path,
'_token' => $mashape_token,
'_method' => 'uploadImage',
'access_token' => $_SESSION['tiny_access_token'],
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
$response = json_decode($response);
$image_token = $response->result->token;
echo ' done! see <a href="'.$response->result->thumbnail.'" target="_blank">thumbnail</a><p>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment