<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: PHP at the command prompt</title>
	<atom:link href="http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/</link>
	<description></description>
	<pubDate>Wed, 08 Oct 2008 10:44:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Satyajeet</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-13725</link>
		<dc:creator>Satyajeet</dc:creator>
		<pubDate>Wed, 22 Dec 2004 12:15:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-13725</guid>
		<description>Michel V,
were you able to get your blogpost to have  a title??
The blogger.newPost method of the blogger API doesnt let you specify a title to the post
Thanks</description>
		<content:encoded><![CDATA[<p>Michel V,<br />
were you able to get your blogpost to have  a title??<br />
The blogger.newPost method of the blogger API doesnt let you specify a title to the post<br />
Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raging Platypus</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9384</link>
		<dc:creator>Raging Platypus</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9384</guid>
		<description>&lt;trackback /&gt;&lt;strong&gt;PHP at the command prompt&lt;/strong&gt;
scriptygoddess: "I'm running this script on a Unix system, so I can
make use of an excellent utility called wget, which is a command line
utility to download files via HTTP and is very configurable."
</description>
		<content:encoded><![CDATA[<trackback /><strong>PHP at the command prompt</strong><br />
scriptygoddess: &#034;I&#039;m running this script on a Unix system, so I can<br />
make use of an excellent utility called wget, which is a command line<br />
utility to download files via HTTP and is very configurable.&#034;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WE ARE HUGH</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9383</link>
		<dc:creator>WE ARE HUGH</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9383</guid>
		<description>&lt;trackback /&gt;&lt;strong&gt;PHP at the command prompt&lt;/strong&gt;
scriptygoddess: "I'm running this script on a Unix system, so I can
make use of an excellent utility called wget, which is a command line
utility to download files via HTTP and is very configurable."</description>
		<content:encoded><![CDATA[<trackback /><strong>PHP at the command prompt</strong><br />
scriptygoddess: &#034;I&#039;m running this script on a Unix system, so I can<br />
make use of an excellent utility called wget, which is a command line<br />
utility to download files via HTTP and is very configurable.&#034;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ihab Hassan</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9382</link>
		<dc:creator>Ihab Hassan</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9382</guid>
		<description>I need to call php.exe to from a perl script that I wrote.

Basically perl will open a file, print some text and then want to execute php to execute another php file that also open the same file created by perl earlier, print more text and then close.

The final result is a final file with the output from both the perl and the php. &lt;b&gt;My codes are below&lt;/b&gt;:-

&lt;b&gt;PERL&lt;/b&gt;

#!D:/FoxServ/perl/bin/perl

use strict;


my &#36;message="Thank you for uing BuyPhoneCardsOnline.NET&#92;n&#92;nYour Order will be delivered shortly to the EMAIL provided on your Order&#92;n&#92;nPlease contact us at (214) 697-3947 with any issues&#92;n&#92;nWe look forward to doing business with you in the near future&#92;n"; 
my &#36;message2="Thanks";

# Save the message into a text file. The text file is automatically deleted by blat. 
open (messtxt1,"&gt;D:/FoxServ/perl/bin/php/message.data");
print messtxt1 (&#36;message); 
close messtxt1; 

# Punch out to run the PHP file so that to incorporate the PIN information
my &#36;php="D:/FoxServ/perl/bin/php/php -q final.php";

# Now execture PHP to include PIN
system(&#36;php); 

&lt;b&gt;PHP&lt;/b&gt;

&#60;?php

&#36;fp = fopen("message2.data", "a") or die("Couldn't create new file");
&#36;numBytes = fwrite(&#36;fp, "&#92;r&#92;nLook, it's a brand new line!");
fclose(&#36;fp);

echo "Wrote &#36;numBytes bytes to the end of newfile.file!";

?&#62;</description>
		<content:encoded><![CDATA[<p>I need to call php.exe to from a perl script that I wrote.</p>
<p>Basically perl will open a file, print some text and then want to execute php to execute another php file that also open the same file created by perl earlier, print more text and then close.</p>
<p>The final result is a final file with the output from both the perl and the php. <b>My codes are below</b>:-</p>
<p><b>PERL</b></p>
<p>#!D:/FoxServ/perl/bin/perl</p>
<p>use strict;</p>
<p>my &#36;message=&#034;Thank you for uing BuyPhoneCardsOnline.NET&#92;n&#92;nYour Order will be delivered shortly to the EMAIL provided on your Order&#92;n&#92;nPlease contact us at (214) 697-3947 with any issues&#92;n&#92;nWe look forward to doing business with you in the near future&#92;n&#034;;<br />
my &#36;message2=&#034;Thanks&#034;;</p>
<p># Save the message into a text file. The text file is automatically deleted by blat.<br />
open (messtxt1,&#034;>D:/FoxServ/perl/bin/php/message.data&#034;);<br />
print messtxt1 (&#36;message);<br />
close messtxt1; </p>
<p># Punch out to run the PHP file so that to incorporate the PIN information<br />
my &#36;php=&#034;D:/FoxServ/perl/bin/php/php -q final.php&#034;;</p>
<p># Now execture PHP to include PIN<br />
system(&#36;php); </p>
<p><b>PHP</b></p>
<p>&lt;?php</p>
<p>&#36;fp = fopen(&#034;message2.data&#034;, &#034;a&#034;) or die(&#034;Couldn&#039;t create new file&#034;);<br />
&#36;numBytes = fwrite(&#36;fp, &#034;&#92;r&#92;nLook, it&#039;s a brand new line!&#034;);<br />
fclose(&#36;fp);</p>
<p>echo &#034;Wrote &#36;numBytes bytes to the end of newfile.file!&#034;;</p>
<p>?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: michel v</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9381</link>
		<dc:creator>michel v</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9381</guid>
		<description>My bad, I misspelled the shebang lines.
For Unix/Linux: #!/usr/bin/php -q
For Windows: #!C:/php/php.exe -q
(Of course the paths may be different, it all depends on where PHP is installed.)

And then for further information, nothing best than a page from the official documentation! :)
http://www.php.net/manual/en/features.commandline.php</description>
		<content:encoded><![CDATA[<p>My bad, I misspelled the shebang lines.<br />
For Unix/Linux: #!/usr/bin/php -q<br />
For Windows: #!C:/php/php.exe -q<br />
(Of course the paths may be different, it all depends on where PHP is installed.)</p>
<p>And then for further information, nothing best than a page from the official documentation! <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <a href="http://www.php.net/manual/en/features.commandline.php" rel="nofollow">http://www.php.net/manual/en/features.commandline.php</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dave</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9380</link>
		<dc:creator>dave</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9380</guid>
		<description>michel v is correct for all Unix/Linux users out there... I am *extremely* lazy about adding in the shebang line to my scripts.. probably because I write then discard the scripts most of the time.

If you write scripts you are gonna use more than a few times, throw in the shebang line &#038; save yourself some typing (the equivilent in Windows would be to associate the .php extention with php.exe)

Good trick</description>
		<content:encoded><![CDATA[<p>michel v is correct for all Unix/Linux users out there&#8230; I am *extremely* lazy about adding in the shebang line to my scripts.. probably because I write then discard the scripts most of the time.</p>
<p>If you write scripts you are gonna use more than a few times, throw in the shebang line &#038; save yourself some typing (the equivilent in Windows would be to associate the .php extention with php.exe)</p>
<p>Good trick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: michel v</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9379</link>
		<dc:creator>michel v</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9379</guid>
		<description>You may want to add that PHP command line scripts, much like Perl scripts, can have a shebang line.
On most Unix/Linux systems, this would be: &lt;i&gt;!#/usr/bin/php -q&lt;/i&gt;
Using the shebang line is useful when you set the script file to be executable (chmod +x). This way you can also get rid of the .php extension and pretend that the script is just another executable on your system: instead of typing &lt;i&gt;php ./filename.php&lt;/i&gt; you'd just have to type &lt;i&gt;./filename&lt;/i&gt;.

And then you could have made use of PHP's handling of  command line parameters, instead of relying on editing the file to change the path. :) 

--
Months ago, I made a Blogger-API compatible command-line blog app in PHP, named blog2.
(I'd give a link, but my webhost is currently down so I'll just give the link in a later comment.)

To post "hello world", I only needed to type &lt;i&gt;blog2 p "hello world"&lt;/i&gt; and then it would magically send an XMLRPC command (using &lt;a href="http://scripts.incutio.com/xmlrpc/"&gt;IXR&lt;/a&gt;) to post that on my blog and give me the new post's ID (for this example we'll say 50). To edit that post I could type &lt;i&gt;blog2 e 50 "new content".
And then there's more than just replacing content, I could append/prepend content to a post. To append I used e-, to prepend I used -e. Exemple: &lt;i&gt;blog2 -e 50 "&#92;nlook, a new line"&lt;/i&gt;.
Moreover, that app could also transform your quotes into elegant/smart quotes via calling a little Perl script.

...Just a proof of concept that PHP on the command line is pretty fun. :)&lt;/i&gt;</description>
		<content:encoded><![CDATA[<p>You may want to add that PHP command line scripts, much like Perl scripts, can have a shebang line.<br />
On most Unix/Linux systems, this would be: <i>!#/usr/bin/php -q</i><br />
Using the shebang line is useful when you set the script file to be executable (chmod +x). This way you can also get rid of the .php extension and pretend that the script is just another executable on your system: instead of typing <i>php ./filename.php</i> you&#039;d just have to type <i>./filename</i>.</p>
<p>And then you could have made use of PHP&#039;s handling of  command line parameters, instead of relying on editing the file to change the path. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8211;<br />
Months ago, I made a Blogger-API compatible command-line blog app in PHP, named blog2.<br />
(I&#039;d give a link, but my webhost is currently down so I&#039;ll just give the link in a later comment.)</p>
<p>To post &#034;hello world&#034;, I only needed to type <i>blog2 p &#034;hello world&#034;</i> and then it would magically send an XMLRPC command (using <a href="http://scripts.incutio.com/xmlrpc/">IXR</a>) to post that on my blog and give me the new post&#039;s ID (for this example we&#039;ll say 50). To edit that post I could type <i>blog2 e 50 &#034;new content&#034;.<br />
And then there&#039;s more than just replacing content, I could append/prepend content to a post. To append I used e-, to prepend I used -e. Exemple: </i><i>blog2 -e 50 &#034;&#92;nlook, a new line&#034;</i>.<br />
Moreover, that app could also transform your quotes into elegant/smart quotes via calling a little Perl script.</p>
<p>&#8230;Just a proof of concept that PHP on the command line is pretty fun. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gregory</title>
		<link>http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9378</link>
		<dc:creator>Gregory</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.scriptygoddess.com/archives/2003/03/11/php-at-the-command-prompt/#comment-9378</guid>
		<description>I actually just started using PHP at the command line level  too.  It is great when you want to have scripts that build pages.  But I've been using it for some general scripting also.

Also. if your system doesn't have wget on it, you shoudl check forl 'curl' (which I like a bit better myself).</description>
		<content:encoded><![CDATA[<p>I actually just started using PHP at the command line level  too.  It is great when you want to have scripts that build pages.  But I&#039;ve been using it for some general scripting also.</p>
<p>Also. if your system doesn&#039;t have wget on it, you shoudl check forl &#039;curl&#039; (which I like a bit better myself).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.349 seconds -->
