<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How to configure a PHP script that generates Twitter images?</title>
	<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images/</link>
	<description>Comments on Ask MetaFilter post How to configure a PHP script that generates Twitter images?</description>
	<pubDate>Mon, 19 Nov 2007 03:17:56 -0800</pubDate>
	<lastBuildDate>Mon, 19 Nov 2007 03:17:56 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How to configure a PHP script that generates Twitter images?</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images</link>	
		<description>Need an assist from the PHP gurus. I&apos;m trying to set up a PHP script that generates an image from the latest Twitter status. &lt;br /&gt;&lt;br /&gt; I&apos;m working off an example &lt;a href=&quot;http://www.loonypandora.com/2007/07/12/make-an-image-from-your-twitter-status/&quot;&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
Followed the instructions there explicitly -- tried saving the script as a PHP file and got errors like this:&lt;br&gt;
&lt;br&gt;
Warning: filemtime(): Stat failed for twitter.txt (errno=2 - No such file or directory) in [...] on line 30&lt;br&gt;
&lt;br&gt;
Fatal error: Call to undefined function: simplexml_load_file() in [...] on line 34&lt;br&gt;
&lt;br&gt;
I assigned the correct permissions to the file. When I tried renaming the file as a PNG (as suggested for using on forums that require an image extension), it just gives me a corrupt PNG file when I access it. Trying both versions of .htaccess suggested in the example did not fix this.&lt;br&gt;
&lt;br&gt;
Other possibly relevant info: test site is hosted on GoDaddy and I&apos;m not sure if there&apos;s any PHP issues with them.&lt;br&gt;
&lt;br&gt;
So, is there something obvious I might be missing that isn&apos;t listed on the above linked site? Is there an easier way to generate an image of Twitter updates?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.76578</guid>
		<pubDate>Mon, 19 Nov 2007 02:45:32 -0800</pubDate>
		<dc:creator>empyrean</dc:creator>
		
			<category>PHP</category>
		
			<category>Twitter</category>
		
			<category>PNG</category>
		
			<category>htaccess</category>
		
			<category>forums</category>
		
			<category>signature</category>
		
	</item> <item>
		<title>By: missmagenta</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137804</link>	
		<description>You need php5 to use simplexml. Theres a backport for php4 but the syntax to use it is a little different. I know the site says it will work in php4 but it wont, at least not without some modification. &lt;br&gt;
The other error is exactly what it says, there&apos;s no file twitter.txt, this isn&apos;t a major issue - if php has write permissions for the folder, you should only get this error the first time the script runs successfully - after that the file should  exist because the script will have created it. &lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.ister.org/code/simplexml44/index.html&quot;&gt;This is the php4 simplexml backport&lt;/a&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137804</guid>
		<pubDate>Mon, 19 Nov 2007 03:17:56 -0800</pubDate>
		<dc:creator>missmagenta</dc:creator>
	</item><item>
		<title>By: Smoosh Faced Lion</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137808</link>	
		<description>Beyond the need for simpleXML, as missmagenta points out, a simple &apos;if &lt;a href=&quot;http://php.net/file_exists&quot;&gt;file_exists()&lt;/a&gt;&apos; statement will let you avoid the warning.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137808</guid>
		<pubDate>Mon, 19 Nov 2007 03:55:16 -0800</pubDate>
		<dc:creator>Smoosh Faced Lion</dc:creator>
	</item><item>
		<title>By: empyrean</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137833</link>	
		<description>Thanks for that, I dug around Godaddy&apos;s site and found that it wanted a .PHP5 extension to execute correctly. So, I can get it to work from twitter.PHP5, but now I&apos;m having trouble with renaming it as twitter.png and working correctly.&lt;br&gt;
&lt;br&gt;
When I do this and load the PNG file, it just echoes the PHP code to the browser window instead of opening a graphic file (which works fine as a .PHP5 file). &lt;br&gt;
&lt;br&gt;
I&apos;m using this in the directory&apos;s .htaccess file:&lt;br&gt;
&lt;br&gt;
AddType x-mapp-php5 .png&lt;br&gt;
&lt;br&gt;
Should I try something else?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137833</guid>
		<pubDate>Mon, 19 Nov 2007 05:08:56 -0800</pubDate>
		<dc:creator>empyrean</dc:creator>
	</item><item>
		<title>By: missmagenta</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137855</link>	
		<description>You don&apos;t necessarily need to rename it to .png - this is only if you&apos;re trying to use it somewhere that restricts non-image file extensions in image tags.&lt;br&gt;
Where are you trying to use it? Have you tried just using the php5 file? eg. &lt;&gt;&lt;br&gt;
&lt;br&gt;
If you really need it to be a .png file then you could try also adding&lt;br&gt;
&lt;br&gt;
AddHandler x-mapp-php5 .png or AddType application/x-httpd-php5 .png&lt;br&gt;
&lt;br&gt;
I don&apos;t know their server setup so its hard to say precisely. Do godaddy allow you to add/edit your mime types?&lt;/&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137855</guid>
		<pubDate>Mon, 19 Nov 2007 05:49:39 -0800</pubDate>
		<dc:creator>missmagenta</dc:creator>
	</item><item>
		<title>By: missmagenta</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137856</link>	
		<description>hmm, the eg. didn&apos;t come out right there (was fine in the live preview :( )&lt;br&gt;
&amp;lt;img src = &quot;twitter.php5&quot; /&amp;gt;&lt;br&gt;
&lt;br&gt;
Also, where are you putting the .htaccess?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137856</guid>
		<pubDate>Mon, 19 Nov 2007 05:51:27 -0800</pubDate>
		<dc:creator>missmagenta</dc:creator>
	</item><item>
		<title>By: empyrean</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137867</link>	
		<description>Yes, I do need it to be a .png for exactly the reason you listed - non-image file extensions are restricted.&lt;br&gt;
&lt;br&gt;
Tried adding the two different suggestions into the .htaccess file and no luck. The .htaccess file is in the /status directory I created, which is the same folder as the php5/png files.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137867</guid>
		<pubDate>Mon, 19 Nov 2007 06:01:17 -0800</pubDate>
		<dc:creator>empyrean</dc:creator>
	</item><item>
		<title>By: empyrean</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137869</link>	
		<description>Missed this one:&lt;br&gt;
&lt;br&gt;
&lt;em&gt;I don&apos;t know their server setup so its hard to say precisely. Do godaddy allow you to add/edit your mime types?&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Yes, &lt;a href=&quot;http://help.godaddy.com/article.php?article_id=375&amp;topic_id=306&quot;&gt;they do&lt;/a&gt; if you have their Host Configuration 2.0, which I checked and I do have that.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137869</guid>
		<pubDate>Mon, 19 Nov 2007 06:03:48 -0800</pubDate>
		<dc:creator>empyrean</dc:creator>
	</item><item>
		<title>By: missmagenta</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137883</link>	
		<description>Do you have a control panel or something where you can see a list of configured mime types? From that you should be able to tell exactly which line you need to use. &lt;br&gt;
&lt;br&gt;
eg. if you have a line like &lt;br&gt;
&lt;br&gt;
application/x-httpd-php5 .php5&lt;br&gt;
&lt;br&gt;
then your .htaccess line would be &lt;br&gt;
&lt;br&gt;
AddHandler application/x-httpd-php5 .png&lt;br&gt;
&lt;br&gt;
You could try:&lt;br&gt;
&lt;br&gt;
AddHandler x-httpd-php5 .png&lt;br&gt;
&lt;br&gt;
although, that would be unusual, I did find a reference to using that syntax on godaddy through google - could be a typo though.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137883</guid>
		<pubDate>Mon, 19 Nov 2007 06:20:42 -0800</pubDate>
		<dc:creator>missmagenta</dc:creator>
	</item><item>
		<title>By: Leon</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137885</link>	
		<description>&lt;em&gt;Yes, I do need it to be a .png for exactly the reason you listed - non-image file extensions are restricted&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Try using mod_rewrite rules in .htaccess to map requests for file.png to file.php5</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137885</guid>
		<pubDate>Mon, 19 Nov 2007 06:23:02 -0800</pubDate>
		<dc:creator>Leon</dc:creator>
	</item><item>
		<title>By: empyrean</title>
		<link>http://ask.metafilter.com/76578/How-to-configure-a-PHP-script-that-generates-Twitter-images#1137901</link>	
		<description>It works!&lt;br&gt;
&lt;br&gt;
I think GoDaddy was being extremely quirky with the htaccess file and caching. Their site states new files take up to 60 minutes to become active and changes to existing files should be instantaneous, but I didn&apos;t find that to be the case.&lt;br&gt;
&lt;br&gt;
Whatever the current one is in the cache is the one that&apos;s working now, I&apos;ll have to re-check it in an hour or two and see if I need to change it back to something else.&lt;br&gt;
&lt;br&gt;
Thanks a lot for the help, especially from missmagenta.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.76578-1137901</guid>
		<pubDate>Mon, 19 Nov 2007 06:45:47 -0800</pubDate>
		<dc:creator>empyrean</dc:creator>
	</item>
	</channel>
</rss>
