I have this piece of code to get the file from AWS S3 using aws/aws-sdk-php-laravel package.
try {
$s3Client = AWS::createClient('s3');
$result = $s3Client->getObject([
'Bucket' => static::$s3Bucket,
'Key' => $fileName
]);
return $result['Body']->getContents();
} catch (S3Exception $e) {
return;
}
it working fine, but when I tried to using explode(PHP_EOL, $result['Body']->getContents()); it's only showing 1 array, and inside that array there will be the result from the jsonl file, so how to extract the json data from jsonl file?
var_export($result['Body']->getContents());. so that we can come to know how actual data look like and why you are facing issueexplode("\n",PHP_EOLinstead"\n", now its working fine