0

Im trying to get a content from a file inside /report/ and get the result from that php script into the body tag.

Heres the example url that im using

$mail->Body = file_get_contents('../Report/index.php?sec=1&abrev=CRGV&ex=ex%202022&num=5530');

Also tried to do ob_get contents then include the file but it does not work as well. it says Warning: file_get_contents(../Report/index.php?sec=1&abrev=CRGV&ex=ex%202022&num=5530): Failed to open stream: No such file or directory in C:\laragon\www\Emailer\index.php on line 54

If i do the exact same funcion but with a txt file

$mail->Body = file_get_contents('../Report/teste.txt');

It loads the content of the file

Both files are next to each other. index.php and teste.txt

Why does it load one but not the other?

Can't i pass GET variables?

Alexandre Calvario
  • 143
  • 1
  • 1
  • 11
  • `file_get_contents()` by default opens files via the filesystem when given a path. You'll either need to make an HTTP request or instead, set up the `$_GET` variables yourself and `include` the file, capturing the result with output buffering – Phil Nov 23 '22 at 02:39

0 Answers0