I try to load the excel file into one web application, I do this (it does not return any errors, but the array does not come back, which should come):

$this->headers = [ "Content-Type: multipart/form-data", "Referer: http://domain.com/hand.html", "Origin: http://domain.com", "UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" ]; $post = [ "file" => curl_file_create ("../../test.xlsx"), "name" => "test.xlsx", "name" => "test.xlsx" ]; $this->curl = curl_init ($url); curl_setopt ($this->curl, CURLOPT_RETURNTRANSFER, true); curl_setopt ($this->curl, CURLOPT_HTTPHEADER, $this->headers); curl_setopt ($this->curl, CURLOPT_POST, true); curl_setopt ($this->curl, CURLOPT_POSTFIELDS, $post); $result = curl_exec ($this->curl); curl_close ($this->curl); $json = json_decode ($result, true); return $json; 
  • ...... exec ...... if (! curl_errno ($ this-> curl)) {$ info = curl_getinfo ($ this-> curl); print_r ($ info); } - sterx
  • Error 26 - CURLE_READ_ERROR - Jacob
  • Callback Most likely the file you are sending is unavailable - print_r (is_file ()) make - sterx
  • wrapped the path in realpath, now the error is CURLE_UNSUPPORTED_PROTOCOL (is_file === true) - Jacob
  • is_file showed true? - sterx

1 answer 1

All) figured it out ... 1 - check if the path to the file is correctly specified as sterx said, through is_file 2 - the path needed to be wrapped additionally in realpath 3 - remove the Content-Length header: $ size, since removing it all loaded normally and quickly ... I put it because I read one of the articles where it was stated that this title must be transferred ... Strange, but oh well)