Reputation: 1229
Can I run a php script from command line with the following usage:
php http://phpfile.php username password config_file
When I run this it says cannot open input file http://phpfile.php
If there is what would be the best way to execute this within a php script?
Thanks
Upvotes: 0
Views: 3892
Reputation: 9630
This is practically not possible. You cannot execute a php script hosted on someone else's server in your cli.
Consider this case. Facebook has a php script which adds a comment to the database. So What would be the outcome if someone executes this script from local command line, and goes about adding comments to the database ? This would really mess up the systems. Or consider something like a file hosting script. You can very well imagine the outcomes if anyone can delete any file from their own cli.
The file can be executed if:
You can execute it only if the owner allows it (via get and post requests)
Do a post request using Guide to making requests
Upvotes: 2