通过命令行使用header命令运行PHP脚本

I try to run a PHP script on my raspberry pi via command line, this part works fine. I use this command : php myscript.php

But I use a header command in this script, to access another script on another server like this : header("Location: http://www.anotherserver.com/myscript"). This script works also fine when I run it from my web browser, but when I run it from the command line, the header part will be not executed.

Do you have any solution for this problem ? Thanks alot.

You can use exec ( instead of header to execute another script from the current script.