Well using two packages (which can be stripped to only one) I managed to create a bash script that will take the php script file and transform it to html (which is saved temporarily in the current directory), thus being able to run it easily in firefox. Here we go!
Firstly, install the packages, in Ubuntu:
sudo apt-get install php5-cli debianutils
From these packages we'll use the php command (php5-cli) and the tempfile command (debianutils)
Next we create the bash "phpview" convert script. Fire up the terminal (Applications > Accessories > Terminal):
Inside place the following code:
file=`tempfile -d . -s .html`
echo "Creating file: $file"
php5 $1 > $file
echo "Press any key to delete the temporary html file or ctrl-c to stop this script and keep it"
echo "Removing $file"
Save and close the gedit text editor and make phpview.sh executable:
chmod +x $HOME/phpview.sh
That's about it, we can create a test php/html file:
Place in the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<body><?php echo "Hello world!"; ?></body>
Save and close.
Now let's test it!!
I am the webmaster of www.pinhole-glasses-direct.com
I was reading your blog and I see you have a very impressive way of describing things. The information you provide is very helpful. So I was wondering if you could take a look at our product pinhole glasses and write a review about and post it in your blog.
I would really be interested to know if you would be able to post the review in your blog with links to our site.
Πολύ χρήσιμη είναι και η wget με τα flags --post-data --post-file για να κάνεις post/get στο αρχείο.
Post a Comment