<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Good News / Bad News</title>
	<atom:link href="http://www.charles-reace.com/blog/2010/03/21/good-news-bad-news/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.charles-reace.com/blog/2010/03/21/good-news-bad-news/</link>
	<description>Charles Reace&#039;s blog about PHP, MySQL, and life in general</description>
	<lastBuildDate>Mon, 22 Aug 2011 17:18:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: bpat1434</title>
		<link>http://www.charles-reace.com/blog/2010/03/21/good-news-bad-news/comment-page-1/#comment-1765</link>
		<dc:creator>bpat1434</dc:creator>
		<pubDate>Mon, 13 Sep 2010 04:01:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.charles-reace.com/blog/?p=259#comment-1765</guid>
		<description>You could simplify things a lot more and just use PHP&#039;s streams to send the output directly to the user.

&lt;code&gt;
header(&quot;Content-Type&quot;, &quot;text/csv&quot;, true);
header(&quot;Content-Disposition&quot;, &quot;attachment; filename=&#039;my-filename.csv&#039;&quot;, true);
$fp = fopen(&quot;php://stdout&quot;, &quot;w&quot;);
&lt;/code&gt;

Then do your normal fputcsv() stuff.  Don&#039;t forget to send the headers prior to opening that pointer.  Much simpler than writing to a temp file and reading it back later if all you&#039;re doing is sending it to the user ;)</description>
		<content:encoded><![CDATA[<p>You could simplify things a lot more and just use PHP&#8217;s streams to send the output directly to the user.</p>
<p><code><br />
header("Content-Type", "text/csv", true);<br />
header("Content-Disposition", "attachment; filename='my-filename.csv'", true);<br />
$fp = fopen("php://stdout", "w");<br />
</code></p>
<p>Then do your normal fputcsv() stuff.  Don&#8217;t forget to send the headers prior to opening that pointer.  Much simpler than writing to a temp file and reading it back later if all you&#8217;re doing is sending it to the user ;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

