lawrence_dev
asked on
How do I execute a file from within a PHP script with headers already sent?
How do I execute a file from within a PHP script with headers already sent?
I have this code at the bottom of a php script. However, I am getting a "Headers Already Sent" error. Is there a way to get around that?
I have this code at the bottom of a php script. However, I am getting a "Headers Already Sent" error. Is there a way to get around that?
$path = '/home/*********/public_html/*********/Feed-Master.php';
exec($path, $output,$return);
var_dump($return);
ASKER
Ray,
I placed ob start at the top of the page and that returned the headers already sent error. So I moved it to the bottom and received the same error.
Warning: Cannot modify header information - headers already sent by (output started at /home/*******/public_html/ *******/Pr oductFeed- Master.php :2) in /home/*********/public_htm l/*******/ ProductFee d--Master. php on line 308
I placed ob start at the top of the page and that returned the headers already sent error. So I moved it to the bottom and received the same error.
Warning: Cannot modify header information - headers already sent by (output started at /home/*******/public_html/
ob_start();
header('/home/******/public_html/********/BingFeed-Master.php');
exit();
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I got it to work. Thanks for your help!
ob_start();
$return = include '/home/*******/public_html/*******/BingFeed-Master.php';
$return = ob_get_clean();
https://www.experts-exchange.com/articles/4423/Warning-Cannot-modify-header-information-headers-already-sent.html