image - Cannot Upload to Imgur PHP -
this code works, has not been working , don't know why... never touch it, suspect ever since reinstalled google chrome has had sort of effect. here error,
file_get_contents(http://api.imgur.com/3/image): failed open stream: http request failed! http/1.0 403 forbidden in c:\xampp\htdocs\project\administrator\index.php on line 92
if (isset($_post['change1'])) { $image = base64_encode(file_get_contents($_files['image1']['tmp_name'])); $options = array('http'=>array( 'method'=>"post", 'header'=>"authorization: bearer 5ac2b1b64fdfea5e062d5c477a49c68b69993213\n". "content-type: application/x-www-form-urlencoded", 'content'=>$image )); $imgururl = "http://api.imgur.com/3/image"; $context = stream_context_create($options); $response = file_get_contents($imgururl, false, $context); $response = json_decode($response); db::query("update products set image1=:image1 id=:id",array(':image1'=>$response->data->link,':id'=>$_get['edit'])); }
Comments
Post a Comment