Cannot Upload to Imgur PHP

503
April 15, 2017, at 04:05 AM

This Code normally works, But recently it has not been working and I don't know why... I never touch it, but I suspect that ever since I reinstalled google Chrome It has had some sort of effect. Here is the error,

file_get_contents(http://api.imgur.com/3/image): failed to 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 WHERE id=:id",array(':image1'=>$response->data->link,':id'=>$_GET['edit'])); 
 
	 
}

Rent Charter Buses Company
READ ALSO
cURL reading an Excel file error

cURL reading an Excel file error

I am trying to execute cURL on a url that is generated using code and stored in a variableI am having the problem that when I directly pass that variable as url no data is fetched

376
PHP file upload error conditions

PHP file upload error conditions

I am trying to create a profile editing setupIt seems as though the information is edited only when an image is being uploaded

487
How to make a column common from unique in phpmyadmin

How to make a column common from unique in phpmyadmin

I have created table in there I choosed a column to be unique AND now I want that column to be common not unique in phpmyadminI could not found any option like that

327
No JSON response from PHP

No JSON response from PHP

I have a JSON POST request being sent to indexphp as part of a login application for a mobile device

422