I am using Facebook SDK to post some test wall post on my own facebook page. It works fine when i run the script on my browser but when i run it from terminal it gives me as err
The cron executes the PHP not like a module of apache, so many environment variables are not set by the server. When executing from cron your PHP script is like GCI one, more precisely its CLI (command line interface - php-cli). So as you can imagine, there is no web server and there is no HTTP_HOST.
PS: You can transfer data (urls, hostname or whatever you like) as command line arguments (environment variables) to PHP: Command line usage
Addition:
$php -f cronjob.php HTTP_HOST=www.mysite.com #example