0

I have a csv file from a remote path in a response as below . I am trying to read the columns on the excel file but i get the error file not found at path: 501149794557447800.csv .

What could i be missing here ?

Response

'payload' => 
    array (
      'caption' => 'Shops.csv',
      'name' => 'Shops.csv',
      'url' => 'https://filemanager.gupshup.io/fm/wamedia/data/5a060d55-7cb9-4b8b-af5a-4acb80150c83',
      'contentType' => 'text/csv',
      'urlExpiry' => 1621764623078,
    ),

Controller

  $file = file_get_contents($payload['payload']['url']);

  $theArray = Excel::toArray([], $file.'.csv');

  $theArray = Excel::toArray([], $file.'.csv');

  foreach ($theArray[0] as $key => $value)
  {
                  
  }
JustCarty
  • 3,839
  • 5
  • 31
  • 51
  • why are you using `$file.'.csv'`? You are appending file contents with a `.csv` string here – Flame May 16 '21 at 10:37
  • Where is this `$payload` variable coming from in the Controller? Shouldn't you access the payload from the request object? `$request->input('payload')['url']` ? – fassn May 16 '21 at 14:40

0 Answers0