1

I am trying to read .docx and .doc files in PHP using CURL with a direct URL, but I am getting some errors.

This is my code:

<?php 
function curl_get_contents($url)
{

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}


$url = "https://msysmhsptkazqgnbycne.s3.amazonaws.com/user/RP_Plagscan_1487681880_8206_WV_1486967057_3815_Working Thesis-12 Jul.docx";
$json = json_decode(curl_get_contents($url));

?>

It shows the following error:

HttpVersionNotSupportedThe HTTP version specified is not supported.AED9E1B975ADE9E9FHiIIYR/l/U5r7WOv3KClqBHKdlTguYBTfnd+tWtI/1UUUznjgm1wHzxrXSWI32pzeeGAKLxYNNgJVdDrqdgwXMYNhJy/Vcl

clemens
  • 16,716
  • 11
  • 50
  • 65
Santhosh
  • 43
  • 7
  • I was recently working with curl functions and discovered differences in PHP version. Had to upgrade to 5.6.29 to make it work. So perhaps it's good to add you PHP version to the question. by the way: where does the error show? What is the value of the curl_exec($ch)? Perhaps your URL is faulty (replace spaces with %20)? http://stackoverflow.com/questions/20114175/curl-response-says-http-version-not-supported-error-505 – Pianoman Feb 21 '17 at 14:53

0 Answers0