<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BRADINO &#187; Search Results  &#187;  PHP file_get_contents function</title>
	<atom:link href="http://www.bradino.com/?s=PHP%20file_get_contents%20function&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.bradino.com</link>
	<description>LAMP Development Tutorials, Code, Tips &#38; Tricks</description>
	<lastBuildDate>Sat, 10 Oct 2009 20:49:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Geocoding: Location to Latitude/Longitude</title>
		<link>http://www.bradino.com/php/geocoding-location-latitude-longitude/</link>
		<comments>http://www.bradino.com/php/geocoding-location-latitude-longitude/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 17:09:20 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/?p=4735</guid>
		<description><![CDATA[Both Google and Yahoo offer free geocoding services. Geocoding is the process of getting the latitude/longitude coordinates for a particular address or location. With the latitude/longitude coordinates you can fun things like plot markers on a map, calculate distances between points, etc. I have created two simple standalone functions to geocode an address, one for [...]]]></description>
			<content:encoded><![CDATA[<p>Both Google and Yahoo offer free geocoding services. Geocoding is the process of getting the latitude/longitude coordinates for a particular address or location. With the latitude/longitude coordinates you can fun things like plot markers on a map, calculate distances between points, etc. I have created two simple standalone functions to geocode an address, one for Google and one for Yahoo. Both require an API key. </p>
<p><a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct" target="_blank">Google Documentation</a> <a href="http://code.google.com/apis/maps/signup.html" target="_blank">Google API Key</a> <a href="http://developer.yahoo.com/maps/rest/V1/geocode.html" target="_blank">Yahoo Documentation</a> <a href="http://developer.yahoo.com/wsregapp/" target="_blank">Yahoo API Key</a> </p>
<div class="syntax_hilite">
<div id="php-4">
<div class="php"><span style="color:#FF9933; font-style:italic;">// API KEYS</span></p>
<p><span style="color:#0000FF;">$googleKey</span> = <span style="color:#FF0000;">"INSERT-API-KEY"</span>;</p>
<p><span style="color:#0000FF;">$yahooKey</span> = <span style="color:#FF0000;">"INSERT-API-KEY"</span>;</p>
<p>
<span style="color:#FF9933; font-style:italic;">// ARRAY OF LOCATION PARAMETERS</span></p>
<p><span style="color:#0000FF;">$params</span> = <a href="http://www.bradino.com/php-functions/array/"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'address'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#FF0000;">"2470 E Street"</span>;</p>
<p><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'city'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#FF0000;">"San Diego"</span>;</p>
<p><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'state'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#FF0000;">"CA"</span>;</p>
<p><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'zip'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#FF0000;">"92102"</span>;</div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="php-5">
<div class="php"><span style="color:#FF9933; font-style:italic;">// GEOCODING USING GOOGLE</span></p>
<p><span style="color:#0000FF;">$coords</span> = geocodeGoogle<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span>,<span style="color:#0000FF;">$googleKey</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Latitude: {$coords['latitude']}&lt;br&gt;<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</p>
<p><a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Longitude: {$coords['longitude']}&lt;br&gt;<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</p>
<p>
<span style="color:#FF9933; font-style:italic;">// GOOGLE GEOCODE FUNCTION</span></p>
<p><span style="color:#000000; font-weight:bold;">function</span> geocodeGoogle<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span>,<span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$location</span> = <a href="http://www.bradino.com/php-functions/strtolower/"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">' '</span>,<span style="color:#FF0000;">'+'</span>,<span style="color:#FF0000;">"{$params['address']}, {$params['city']}, {$params['state']}, {$params['zipcode']}"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$url</span> = <span style="color:#FF0000;">"http://maps.google.com/maps/geo?q={$location}&amp;output=csv&amp;key={$key}"</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$response</span> = <a href="http://www.bradino.com/php-functions/file_get_contents/"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$parts</span> = <a href="http://www.bradino.com/php-functions/explode/"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">','</span>,<span style="color:#0000FF;">$response</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#616100;">return</span> <a href="http://www.bradino.com/php-functions/array/"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'latitude'</span> =&gt; <span style="color:#0000FF;">$parts</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#FF0000;">'longitude'</span> =&gt; <span style="color:#0000FF;">$parts</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;">3</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="syntax_hilite">
<div id="php-6">
<div class="php"><span style="color:#FF9933; font-style:italic;">// GEOCODING USING YAHOO</span></p>
<p><span style="color:#0000FF;">$coords</span> = geocodeYahoo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span>,<span style="color:#0000FF;">$yahooKey</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Latitude: {$coords['latitude']}&lt;br&gt;<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</p>
<p><a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Longitude: {$coords['longitude']}&lt;br&gt;<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</p>
<p>
<span style="color:#FF9933; font-style:italic;">// YAHOO GEOCODE FUNCTION</span></p>
<p><span style="color:#000000; font-weight:bold;">function</span> geocodeYahoo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span>,<span style="color:#0000FF;">$key</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$location</span> = <a href="http://www.bradino.com/php-functions/strtolower/"><span style="color:#000066;">strtolower</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/str_replace/"><span style="color:#000066;">str_replace</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">' '</span>,<span style="color:#FF0000;">'+'</span>,<span style="color:#FF0000;">"{$params['address']}, {$params['city']}, {$params['state']}, {$params['zipcode']}"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$url</span> = <span style="color:#FF0000;">"http://local.yahooapis.com/MapsService/V1/geocode?appid={$key}&amp;location={$location}&amp;output=php"</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$response</span> = <a href="http://www.bradino.com/php-functions/file_get_contents/"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$url</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#0000FF;">$data</span> = <a href="http://www.bradino.com/php-functions/unserialize/"><span style="color:#000066;">unserialize</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$response</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p>&nbsp; &nbsp; <span style="color:#616100;">return</span> <a href="http://www.bradino.com/php-functions/array/"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'latitude'</span> =&gt; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'ResultSet'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Result'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Latitude'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#FF0000;">'longitude'</span> =&gt; <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'ResultSet'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Result'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Longitude'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <br />
<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/geocoding/" rel="tag">geocoding</a> <a href="http://www.bradino.com/search/geocode/" rel="tag">geocode</a> <a href="http://www.bradino.com/search/altitude/longitude/" rel="tag">altitude/longitude</a> <a href="http://www.bradino.com/search/latitude/" rel="tag">latitude</a> <a href="http://www.bradino.com/search/longitude/" rel="tag">longitude</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;t=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;h=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;t=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=Both%20Google%20and%20Yahoo%20offer%20free%20geocoding%20services.%20Geocoding%20is%20the%20process%20of%20getting%20the%20latitude%2Flongitude%20coordinates%20for%20a%20particular%20address%20or%20location.%20With%20the%20latitude%2Flongitude%20coordinates%20you%20can%20fun%20things%20like%20plot%20markers%20on%20a%20map%2C%20c" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;t=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;title=Geocoding%3A%20Location%20to%20Latitude%2FLongitude" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F&amp;submitHeadline=Geocoding%3A%20Location%20to%20Latitude%2FLongitude&amp;submitSummary=Both%20Google%20and%20Yahoo%20offer%20free%20geocoding%20services.%20Geocoding%20is%20the%20process%20of%20getting%20the%20latitude%2Flongitude%20coordinates%20for%20a%20particular%20address%20or%20location.%20With%20the%20latitude%2Flongitude%20coordinates%20you%20can%20fun%20things%20like%20plot%20markers%20on%20a%20map%2C%20c&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=Geocoding%3A%20Location%20to%20Latitude%2FLongitude&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fgeocoding-location-latitude-longitude%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/geocoding-location-latitude-longitude/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Mail using Zend Mail</title>
		<link>http://www.bradino.com/php/php-mail-zend-mail-example/</link>
		<comments>http://www.bradino.com/php/php-mail-zend-mail-example/#comments</comments>
		<pubDate>Wed, 30 May 2007 04:33:04 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.bradino.com/php/php-mail-zend-mail-example/</guid>
		<description><![CDATA[This simple function is a simple usage of the Zend Mail functionality. The headers are all formatted nicely, slipping it past many more spam filters than standard PHP mail() function. Basically you just have to pass in an associative array of the required parameters. Many parameters are optional. This function does not have error trapping [...]]]></description>
			<content:encoded><![CDATA[<p>This simple function is a simple usage of the Zend Mail functionality. The headers are all formatted nicely, slipping it past many more spam filters than standard PHP mail() function. Basically you just have to pass in an associative array of the required parameters. Many parameters are optional. This function does not have error trapping or input grooming/validation so depending on where you use it in your code, beware.</p>
<div class="syntax_hilite">
<div id="php-8">
<div class="php"><span style="color:#FF9933; font-style:italic;">//FUNCTION TO SEND EMAIL VIA ZEND MAIL</span><br />
<span style="color:#000000; font-weight:bold;">function</span> sendEmail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.bradino.com/php-functions/ini_set/"><span style="color:#000066;">ini_set</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'include_path'</span>, <span style="color:#FF0000;">'inc/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#616100;">require_once</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'inc/Zend/Mail.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#0000FF;">$mail</span> = <span style="color:#000000; font-weight:bold;">new</span> Zend_Mail<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.bradino.com/php-functions/empty/"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bodyText'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">setBodyText</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bodyText'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.bradino.com/php-functions/empty/"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bodyHtml'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">setBodyHtml</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bodyHtml'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">setFrom</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'fromEmail'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'fromName'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">addTo</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'toEmail'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'toName'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.bradino.com/php-functions/empty/"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bccEmail'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; !<a href="http://www.bradino.com/php-functions/empty/"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bccName'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">addBcc</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bccEmail'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'bccName'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <br />
&nbsp; &nbsp; <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">setSubject</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'subject'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.bradino.com/php-functions/empty/"><span style="color:#000066;">empty</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'attachFile'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; <a href="http://www.bradino.com/php-functions/file_exists/"><span style="color:#000066;">file_exists</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'attachFile'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$at</span> = <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">addAttachment</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/file_get_contents/"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'attachFile'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$at</span>-&gt;<span style="color:#006600;">type</span>&nbsp; &nbsp; &nbsp; &nbsp; = <span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'attachType'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$at</span>-&gt;<span style="color:#006600;">disposition</span> = Zend_Mime::<span style="color:#006600;">DISPOSITION_ATTACHMENT</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$at</span>-&gt;<span style="color:#006600;">filename</span>&nbsp; &nbsp; = <span style="color:#0000FF;">$params</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'attachName'</span><span style="color:#006600; font-weight:bold;">&#93;</span>;<br />
&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span><br />
&nbsp; &nbsp; <span style="color:#0000FF;">$mail</span>-&gt;<span style="color:#006600;">send</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<p>Download <a href="http://framework.zend.com/">Zend Framework</a>. One thing to keep in mind is that you can use the classes in the Zend Framework outside the framework itself. </p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/php mail/" rel="tag">php mail</a> <a href="http://www.bradino.com/search/email/" rel="tag">email</a> <a href="http://www.bradino.com/search/zend mail/" rel="tag">zend mail</a> <a href="http://www.bradino.com/search/mail function/" rel="tag">mail function</a> <a href="http://www.bradino.com/search/sendmail/" rel="tag">sendmail</a> <a href="http://www.bradino.com/search/Zend Framework/" rel="tag">Zend Framework</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;t=PHP%20Mail%20using%20Zend%20Mail" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;h=PHP%20Mail%20using%20Zend%20Mail" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20Mail%20using%20Zend%20Mail&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;=PHP%20Mail%20using%20Zend%20Mail" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;t=PHP%20Mail%20using%20Zend%20Mail" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=This%20simple%20function%20is%20a%20simple%20usage%20of%20the%20Zend%20Mail%20functionality.%20The%20headers%20are%20all%20formatted%20nicely%2C%20slipping%20it%20past%20many%20more%20spam%20filters%20than%20standard%20PHP%20mail%28%29%20function.%20Basically%20you%20just%20have%20to%20pass%20in%20an%20associative%20array%20of%20the%20req" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;t=PHP%20Mail%20using%20Zend%20Mail" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;title=PHP%20Mail%20using%20Zend%20Mail" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F&amp;submitHeadline=PHP%20Mail%20using%20Zend%20Mail&amp;submitSummary=This%20simple%20function%20is%20a%20simple%20usage%20of%20the%20Zend%20Mail%20functionality.%20The%20headers%20are%20all%20formatted%20nicely%2C%20slipping%20it%20past%20many%20more%20spam%20filters%20than%20standard%20PHP%20mail%28%29%20function.%20Basically%20you%20just%20have%20to%20pass%20in%20an%20associative%20array%20of%20the%20req&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20Mail%20using%20Zend%20Mail&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp%2Fphp-mail-zend-mail-example%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php/php-mail-zend-mail-example/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP file function</title>
		<link>http://www.bradino.com/php-functions/file/</link>
		<comments>http://www.bradino.com/php-functions/file/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 05:08:42 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[file    (PHP 3, PHP 4, PHP 5)file -- Reads entire file into an arrayDescriptionarray file ( string filename [, int use_include_path [, resource context]] )&#13;   Identical to file_get_contents(), except that
   file() returns the file in an array. Each
   element of the array corresponds to a line [...]]]></description>
			<content:encoded><![CDATA[<p>file<P>    (PHP 3, PHP 4, PHP 5)</P>file -- Reads entire file into an arrayDescriptionarray file ( string filename [, int use_include_path [, resource context]] )<BR></BR><P>&#13;   Identical to file_get_contents(), except that<br />
   file() returns the file in an array. Each<br />
   element of the array corresponds to a line in the file, with the<br />
   newline still attached.  Upon failure, file()<br />
   returns FALSE.<br />
  </P><P>&#13;   You can use the optional use_include_path parameter<br />
   and set it to "1", if you want to search for the file in the include_path, too.<br />
  </P><P>&#13;   <P></P></p>
<div class="syntax_hilite">
<div id="php-10">
<div class="php"><span style="color:#FF9933; font-style:italic;">// Get a file into an array.&nbsp; In this example we'll go through HTTP to get</span><br />
<span style="color:#FF9933; font-style:italic;">// the HTML source of a URL.</span><br />
<span style="color:#0000FF;">$lines</span> = <a href="http://www.bradino.com/php-functions/file/"><span style="color:#000066;">file</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'http://www.example.com/'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#FF9933; font-style:italic;">// Loop through our array, show HTML source as HTML source; and line numbers too.</span><br />
<span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$lines</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$line_num</span> =&amp;gt; <span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.bradino.com/php-functions/echo/"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"Line #&amp;lt;b&amp;gt;{$line_num}&amp;lt;/b&amp;gt; : "</span> . <a href="http://www.bradino.com/php-functions/htmlspecialchars/"><span style="color:#000066;">htmlspecialchars</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$line</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">"&amp;lt;br /&amp;gt;<span style="color:#000099; font-weight:bold;">\n</span>"</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></p>
<p><span style="color:#FF9933; font-style:italic;">// Another example, let's get a web page into a string.&nbsp; See also file_get_contents().</span><br />
<span style="color:#0000FF;">$html</span> = <a href="http://www.bradino.com/php-functions/implode/"><span style="color:#000066;">implode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">''</span>, <a href="http://www.bradino.com/php-functions/file/"><span style="color:#000066;">file</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'http://www.example.com/'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><P></P><br />
  </P><P>Tip: You can use a URL as a<br />
filename with this function if the fopen wrappers have been enabled.<br />
See fopen() for more details on how to specify<br />
the filename and Appendix N for a list of supported<br />
URL protocols.</P><P>Note:<br />
    Each line in the resulting array will include the line ending, so you<br />
    still need to use rtrim() if you do not want the line<br />
    ending present.<br />
   </P><P>Note: If you are having problems<br />
with PHP not recognizing the line endings when reading files either on or<br />
created by a Macintosh computer, you might want to enable the<br />
auto_detect_line_endings<br />
run-time configuration option.</P><P>Note:<br />
    As of PHP 4.3.0 you can use file_get_contents() to<br />
    return the contents of a file as a string.<br />
   </P><P>&#13;    In PHP 4.3.0 file() became binary safe.<br />
   </P><P>Note: Context support was added<br />
with PHP 5.0.0. For a description of contexts, refer to<br />
Reference CLVIII, Stream Functions.</P><P></P>Warning<P>When using SSL, Microsoft IIS<br />
will violate the protocol by closing the connection without sending a<br />
close_notify indicator.  PHP will report this as "SSL: Fatal Protocol Error"<br />
when you reach the end of the data.  To workaround this, you should lower your<br />
error_reporting level not to include warnings.<br />
PHP 4.3.7 and higher can detect buggy IIS server software when you open<br />
the stream using the https:// wrapper and will suppress the warning for you.<br />
If you are using fsockopen() to create an ssl:// socket,<br />
you are responsible for detecting and suppressing the warning yourself.<br />
</P><P>&#13;   See also readfile(),<br />
   fopen(), fsockopen(),<br />
   popen(), file_get_contents(),<br />
   include(), and<br />
   stream_context_create()<br />
  </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/file/" rel="tag">file</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/file function/" rel="tag">file function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP file function/" rel="tag">PHP file function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;t=PHP%20file%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;h=PHP%20file%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20file%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;=PHP%20file%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;t=PHP%20file%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=file%20%20%20%20%28PHP%203%2C%20PHP%204%2C%20PHP%205%29file%20--%20Reads%20entire%20file%20into%20an%20arrayDescriptionarray%20file%20%28%20string%20filename%20%5B%2C%20int%20use_include_path%20%5B%2C%20resource%20context%5D%5D%20%29%26%2313%3B%20%20%20Identical%20to%20file_get_contents%28%29%2C%20except%20that%0A%20%20%20file%28%29%20returns%20the%20file%20in%20an%20array.%20E" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;t=PHP%20file%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;title=PHP%20file%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F&amp;submitHeadline=PHP%20file%20function&amp;submitSummary=file%20%20%20%20%28PHP%203%2C%20PHP%204%2C%20PHP%205%29file%20--%20Reads%20entire%20file%20into%20an%20arrayDescriptionarray%20file%20%28%20string%20filename%20%5B%2C%20int%20use_include_path%20%5B%2C%20resource%20context%5D%5D%20%29%26%2313%3B%20%20%20Identical%20to%20file_get_contents%28%29%2C%20except%20that%0A%20%20%20file%28%29%20returns%20the%20file%20in%20an%20array.%20E&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20file%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP file_get_contents function</title>
		<link>http://www.bradino.com/php-functions/file_get_contents/</link>
		<comments>http://www.bradino.com/php-functions/file_get_contents/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 05:08:40 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[file_get_contents    (PHP 4 &#62;= 4.3.0, PHP 5)file_get_contents -- Reads entire file into a stringDescriptionstring file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )
     Identical to file(), except that
     file_get_contents() returns the file in a string,
  [...]]]></description>
			<content:encoded><![CDATA[<p>file_get_contents<P>    (PHP 4 &#62;= 4.3.0, PHP 5)</P>file_get_contents -- Reads entire file into a stringDescriptionstring file_get_contents ( string filename [, bool use_include_path [, resource context [, int offset [, int maxlen]]]] )<BR></BR><P><br />
     Identical to file(), except that<br />
     file_get_contents() returns the file in a string,<br />
     starting at the specified offset up to<br />
     maxlen bytes.<br />
     On failure, file_get_contents() will return FALSE.<br />
    </P><P>&#13;     file_get_contents() is the preferred way to read the<br />
     contents of a file into a string.  It will use memory mapping techniques if<br />
     supported by your OS to enhance performance.<br />
    </P><P>Note:<br />
      If you're opening a URI with special characters, such as spaces, you<br />
      need to encode the URI with urlencode().<br />
     </P><P>Note:<br />
      context parameter can be skipped by NULL.<br />
     </P>ChangeLog<P>&#13;     <P></P>VersionDescription5.0.0&#13;          Added the context support.<br />
         5.1.0&#13;          Added the offset and<br />
          maxlen parameters.<br />
         <P></P><br />
    </P>Notes<P>Note: This function is<br />
binary-safe.</P><P>Tip: You can use a URL as a<br />
filename with this function if the fopen wrappers have been enabled.<br />
See fopen() for more details on how to specify<br />
the filename and Appendix N for a list of supported<br />
URL protocols.</P><P>Note: Context support was added<br />
with PHP 5.0.0. For a description of contexts, refer to<br />
Reference CLVIII, Stream Functions.</P><P></P>Warning<P>When using SSL, Microsoft IIS<br />
will violate the protocol by closing the connection without sending a<br />
close_notify indicator.  PHP will report this as "SSL: Fatal Protocol Error"<br />
when you reach the end of the data.  To workaround this, you should lower your<br />
error_reporting level not to include warnings.<br />
PHP 4.3.7 and higher can detect buggy IIS server software when you open<br />
the stream using the https:// wrapper and will suppress the warning for you.<br />
If you are using fsockopen() to create an ssl:// socket,<br />
you are responsible for detecting and suppressing the warning yourself.<br />
</P>See Also<P>&#13;     <P></P>file()fgets()fread()readfile()file_put_contents()stream_get_contents()stream_context_create()<P></P><br />
    </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/file_get_contents/" rel="tag">file_get_contents</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/file_get_contents function/" rel="tag">file_get_contents function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP file_get_contents function/" rel="tag">PHP file_get_contents function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;t=PHP%20file_get_contents%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;h=PHP%20file_get_contents%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20file_get_contents%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;=PHP%20file_get_contents%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;t=PHP%20file_get_contents%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=file_get_contents%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.3.0%2C%20PHP%205%29file_get_contents%20--%20Reads%20entire%20file%20into%20a%20stringDescriptionstring%20file_get_contents%20%28%20string%20filename%20%5B%2C%20bool%20use_include_path%20%5B%2C%20resource%20context%20%5B%2C%20int%20offset%20%5B%2C%20int%20maxlen%5D%5D%5D%5D%20%29%20%0A%20%20%20%20%20Identical%20t" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;t=PHP%20file_get_contents%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;title=PHP%20file_get_contents%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F&amp;submitHeadline=PHP%20file_get_contents%20function&amp;submitSummary=file_get_contents%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.3.0%2C%20PHP%205%29file_get_contents%20--%20Reads%20entire%20file%20into%20a%20stringDescriptionstring%20file_get_contents%20%28%20string%20filename%20%5B%2C%20bool%20use_include_path%20%5B%2C%20resource%20context%20%5B%2C%20int%20offset%20%5B%2C%20int%20maxlen%5D%5D%5D%5D%20%29%20%0A%20%20%20%20%20Identical%20t&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20file_get_contents%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_get_contents%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/file_get_contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP file_put_contents function</title>
		<link>http://www.bradino.com/php-functions/file_put_contents/</link>
		<comments>http://www.bradino.com/php-functions/file_put_contents/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 05:08:39 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[file_put_contents    (PHP 5)file_put_contents -- Write a string to a fileDescriptionint file_put_contents ( string filename, mixed data [, int flags [, resource context]] )
   Identical to calling fopen(), fwrite(),
   and fclose() successively.
  &#13;   You can also specify the data parameter as an array
   (not [...]]]></description>
			<content:encoded><![CDATA[<p>file_put_contents<P>    (PHP 5)</P>file_put_contents -- Write a string to a fileDescriptionint file_put_contents ( string filename, mixed data [, int flags [, resource context]] )<BR></BR><P><br />
   Identical to calling fopen(), fwrite(),<br />
   and fclose() successively.<br />
  </P><P>&#13;   You can also specify the data parameter as an array<br />
   (not multi-dimension arrays). This is equivalent to<br />
   file_put_contents($filename, implode('', $array)).<br />
  </P><P>&#13;   As of PHP 5.1.0, you may also pass a stream resource to the<br />
   data parameter. In result, the remaining buffer of<br />
   that stream will be copied to the specified file. This is similar with<br />
   using stream_copy_to_stream().<br />
  </P>Parameters<P>&#13;   <P></P>filename<P>&#13;       The file name where to write the data<br />
      </P>data<P>&#13;       The data to write. Can be either a string, an<br />
       array or a stream resource (explained above).<br />
      </P>flags<P>&#13;       flags can take<br />
       FILE_USE_INCLUDE_PATH,<br />
       FILE_APPEND and/or LOCK_EX<br />
       (acquire an exclusive lock), however the<br />
       FILE_USE_INCLUDE_PATH option should be used with<br />
       caution.<br />
      </P>context<P>&#13;       A context resource<br />
      </P><br />
  </P>Return Values<P>&#13;   The function returns the amount of bytes that were written to the file, or<br />
   FALSE on failure.<br />
  </P>ChangeLog<P>&#13;   <P></P>VersionDescription5.1.0&#13;        Added support for LOCK_EX and the ability to pass<br />
        a stream resource to the data parameter<br />
       <P></P><br />
  </P>Notes<P>Note: This function is<br />
binary-safe.</P><P>Note: Context support was added<br />
with PHP 5.0.0. For a description of contexts, refer to<br />
Reference CLVIII, Stream Functions.</P><P>Tip: You can use a URL as a<br />
filename with this function if the fopen wrappers have been enabled.<br />
See fopen() for more details on how to specify<br />
the filename and Appendix N for a list of supported<br />
URL protocols.</P>See Also<P>&#13;   <P></P>fopen()fwrite()file_get_contents()stream_context_create()<P></P><br />
  </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/file_put_contents/" rel="tag">file_put_contents</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/file_put_contents function/" rel="tag">file_put_contents function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP file_put_contents function/" rel="tag">PHP file_put_contents function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;t=PHP%20file_put_contents%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;h=PHP%20file_put_contents%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20file_put_contents%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;=PHP%20file_put_contents%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;t=PHP%20file_put_contents%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=file_put_contents%20%20%20%20%28PHP%205%29file_put_contents%20--%20Write%20a%20string%20to%20a%20fileDescriptionint%20file_put_contents%20%28%20string%20filename%2C%20mixed%20data%20%5B%2C%20int%20flags%20%5B%2C%20resource%20context%5D%5D%20%29%20%0A%20%20%20Identical%20to%20calling%20fopen%28%29%2C%20fwrite%28%29%2C%0A%20%20%20and%20fclose%28%29%20successively.%0A%20%20%26" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;t=PHP%20file_put_contents%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;title=PHP%20file_put_contents%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F&amp;submitHeadline=PHP%20file_put_contents%20function&amp;submitSummary=file_put_contents%20%20%20%20%28PHP%205%29file_put_contents%20--%20Write%20a%20string%20to%20a%20fileDescriptionint%20file_put_contents%20%28%20string%20filename%2C%20mixed%20data%20%5B%2C%20int%20flags%20%5B%2C%20resource%20context%5D%5D%20%29%20%0A%20%20%20Identical%20to%20calling%20fopen%28%29%2C%20fwrite%28%29%2C%0A%20%20%20and%20fclose%28%29%20successively.%0A%20%20%26&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20file_put_contents%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffile_put_contents%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/file_put_contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP fread function</title>
		<link>http://www.bradino.com/php-functions/fread/</link>
		<comments>http://www.bradino.com/php-functions/fread/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 05:07:59 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[fread    (PHP 3, PHP 4, PHP 5)fread -- Binary-safe file readDescriptionstring fread ( resource handle, int length )&#13;   fread() reads up to
   length bytes from the file pointer
   referenced by handle. Reading stops when up to
   length bytes have been read, EOF
   [...]]]></description>
			<content:encoded><![CDATA[<p>fread<P>    (PHP 3, PHP 4, PHP 5)</P>fread -- Binary-safe file readDescriptionstring fread ( resource handle, int length )<BR></BR><P>&#13;   fread() reads up to<br />
   length bytes from the file pointer<br />
   referenced by handle. Reading stops when up to<br />
   length bytes have been read, EOF<br />
   (end of file) is reached, (for network streams) when a packet becomes<br />
   available, or (after opening userspace stream) when 8192 bytes have been read<br />
   whichever comes first.<br />
  </P><P>&#13;   Returns the read string or FALSE in case of error.<br />
  </P><P>&#13;   <P></P></p>
<div class="syntax_hilite">
<div id="php-15">
<div class="php"><span style="color:#FF9933; font-style:italic;">// get contents of a file into a string</span><br />
<span style="color:#0000FF;">$filename</span> = <span style="color:#FF0000;">"/usr/local/something.txt"</span>;<br />
<span style="color:#0000FF;">$handle</span> = <a href="http://www.bradino.com/php-functions/fopen/"><span style="color:#000066;">fopen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$filename</span>, <span style="color:#FF0000;">"r"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#0000FF;">$contents</span> = <a href="http://www.bradino.com/php-functions/fread/"><span style="color:#000066;">fread</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span>, <a href="http://www.bradino.com/php-functions/filesize/"><span style="color:#000066;">filesize</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$filename</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.bradino.com/php-functions/fclose/"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><P></P><br />
  </P><P></P>Warning<P>&#13;    On systems which differentiate between binary and text files<br />
    (i.e. Windows) the file must be opened with 'b' included in<br />
    fopen() mode parameter.<br />
   </P><P>&#13;   <P></P></p>
<div class="syntax_hilite">
<div id="php-16">
<div class="php"><span style="color:#0000FF;">$filename</span> = <span style="color:#FF0000;">"c:<span style="color:#000099; font-weight:bold;">\\</span>files<span style="color:#000099; font-weight:bold;">\\</span>somepic.gif"</span>;<br />
<span style="color:#0000FF;">$handle</span> = <a href="http://www.bradino.com/php-functions/fopen/"><span style="color:#000066;">fopen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$filename</span>, <span style="color:#FF0000;">"rb"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#0000FF;">$contents</span> = <a href="http://www.bradino.com/php-functions/fread/"><span style="color:#000066;">fread</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span>, <a href="http://www.bradino.com/php-functions/filesize/"><span style="color:#000066;">filesize</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$filename</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.bradino.com/php-functions/fclose/"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><P></P><br />
  </P><P></P>Warning<P>&#13;    When reading from anything that is not a regular local file, such as<br />
    streams returned when<br />
    reading remote files or from<br />
    popen() and fsockopen(), reading<br />
    will stop after a packet is available.  This means that you should<br />
    collect the data together in chunks as shown in the examples below.<br />
   </P><P>&#13;   <P></P></p>
<div class="syntax_hilite">
<div id="php-17">
<div class="php"><span style="color:#FF9933; font-style:italic;">// For PHP 5 and up</span><br />
<span style="color:#0000FF;">$handle</span> = <a href="http://www.bradino.com/php-functions/fopen/"><span style="color:#000066;">fopen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"http://www.example.com/"</span>, <span style="color:#FF0000;">"rb"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#0000FF;">$contents</span> = stream_get_contents<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.bradino.com/php-functions/fclose/"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><P></P><br />
  </P><P>&#13;   <P></P></p>
<div class="syntax_hilite">
<div id="php-18">
<div class="php"><span style="color:#0000FF;">$handle</span> = <a href="http://www.bradino.com/php-functions/fopen/"><span style="color:#000066;">fopen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"http://www.example.com/"</span>, <span style="color:#FF0000;">"rb"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#0000FF;">$contents</span> = <span style="color:#FF0000;">''</span>;<br />
<span style="color:#616100;">while</span> <span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.bradino.com/php-functions/feof/"><span style="color:#000066;">feof</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; <span style="color:#0000FF;">$contents</span> .= <a href="http://www.bradino.com/php-functions/fread/"><span style="color:#000066;">fread</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span>, <span style="color:#CC66CC;">8192</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span><br />
<a href="http://www.bradino.com/php-functions/fclose/"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$handle</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><P></P><br />
  </P><P>Note:<br />
    If you just want to get the contents of a file into a string, use<br />
    file_get_contents() as it has much better performance<br />
    than the code above.<br />
   </P><P>&#13;   See also fwrite(), fopen(),<br />
   fsockopen(), popen(),<br />
   fgets(), fgetss(),<br />
   fscanf(), file(), and<br />
   fpassthru().<br />
  </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/fread/" rel="tag">fread</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/fread function/" rel="tag">fread function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP fread function/" rel="tag">PHP fread function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;t=PHP%20fread%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;h=PHP%20fread%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20fread%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;=PHP%20fread%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;t=PHP%20fread%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=fread%20%20%20%20%28PHP%203%2C%20PHP%204%2C%20PHP%205%29fread%20--%20Binary-safe%20file%20readDescriptionstring%20fread%20%28%20resource%20handle%2C%20int%20length%20%29%26%2313%3B%20%20%20fread%28%29%20reads%20up%20to%0A%20%20%20length%20bytes%20from%20the%20file%20pointer%0A%20%20%20referenced%20by%20handle.%20Reading%20stops%20when%20up%20to%0A%20%20%20length%20bytes%20hav" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;t=PHP%20fread%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;title=PHP%20fread%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F&amp;submitHeadline=PHP%20fread%20function&amp;submitSummary=fread%20%20%20%20%28PHP%203%2C%20PHP%204%2C%20PHP%205%29fread%20--%20Binary-safe%20file%20readDescriptionstring%20fread%20%28%20resource%20handle%2C%20int%20length%20%29%26%2313%3B%20%20%20fread%28%29%20reads%20up%20to%0A%20%20%20length%20bytes%20from%20the%20file%20pointer%0A%20%20%20referenced%20by%20handle.%20Reading%20stops%20when%20up%20to%0A%20%20%20length%20bytes%20hav&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20fread%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Ffread%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/fread/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP openssl_pkcs7_encrypt function</title>
		<link>http://www.bradino.com/php-functions/openssl_pkcs7_encrypt/</link>
		<comments>http://www.bradino.com/php-functions/openssl_pkcs7_encrypt/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 04:36:04 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[openssl_pkcs7_encrypt    (PHP 4 &#62;= 4.0.6, PHP 5)openssl_pkcs7_encrypt -- Encrypt an S/MIME messageDescriptionbool openssl_pkcs7_encrypt ( string infile, string outfile, mixed recipcerts, array headers [, int flags [, int cipherid]] )&#13;     openssl_pkcs7_encrypt() takes the contents of the
     file named infile and encrypts them using an RC2
 [...]]]></description>
			<content:encoded><![CDATA[<p>openssl_pkcs7_encrypt<P>    (PHP 4 &#62;= 4.0.6, PHP 5)</P>openssl_pkcs7_encrypt -- Encrypt an S/MIME messageDescriptionbool openssl_pkcs7_encrypt ( string infile, string outfile, mixed recipcerts, array headers [, int flags [, int cipherid]] )<BR></BR><P>&#13;     openssl_pkcs7_encrypt() takes the contents of the<br />
     file named infile and encrypts them using an RC2<br />
     40-bit cipher so that they can only be read by the intended recipients<br />
     specified by recipcerts, which is either a<br />
     lone X.509 certificate, or an array of X.509 certificates.<br />
     headers is an array of headers that<br />
     will be prepended to the data after it has been encrypted.<br />
     flags can be used to specify options that affect<br />
     the encoding process - see PKCS7<br />
     constants.<br />
     headers can be either an associative array<br />
     keyed by header name, or an indexed array, where each element contains<br />
     a single header line.<br />
     Cipher can be selected with cipherid since PHP 5.<br />
    </P><P>&#13;     <P>Example 1. openssl_pkcs7_encrypt() example</P></p>
<div class="syntax_hilite">
<div id="php-20">
<div class="php"><span style="color:#FF9933; font-style:italic;">// the message you want to encrypt and send to your secret agent</span><br />
<span style="color:#FF9933; font-style:italic;">// in the field, known as nighthawk.&nbsp; You have his certificate</span><br />
<span style="color:#FF9933; font-style:italic;">// in the file nighthawk.pem</span><br />
<span style="color:#0000FF;">$data</span> = &amp;lt;&amp;lt;&amp;lt;EOD<br />
Nighthawk,</p>
<p>Top secret, <span style="color:#616100;">for</span> your eyes only!</p>
<p>The enemy is closing in! Meet me at the cafe at <span style="color:#CC66CC;">8</span>.30am<br />
to collect your forged passport!</p>
<p>HQ<br />
EOD;</p>
<p><span style="color:#FF9933; font-style:italic;">// load key</span><br />
<span style="color:#0000FF;">$key</span> = <a href="http://www.bradino.com/php-functions/file_get_contents/"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"nighthawk.pem"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#FF9933; font-style:italic;">// save message to file</span><br />
<span style="color:#0000FF;">$fp</span> = <a href="http://www.bradino.com/php-functions/fopen/"><span style="color:#000066;">fopen</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"msg.txt"</span>, <span style="color:#FF0000;">"w"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.bradino.com/php-functions/fwrite/"><span style="color:#000066;">fwrite</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fp</span>, <span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<a href="http://www.bradino.com/php-functions/fclose/"><span style="color:#000066;">fclose</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$fp</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</p>
<p><span style="color:#FF9933; font-style:italic;">// encrypt it</span><br />
<span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/openssl_pkcs7_encrypt/"><span style="color:#000066;">openssl_pkcs7_encrypt</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"msg.txt"</span>, <span style="color:#FF0000;">"enc.txt"</span>, <span style="color:#0000FF;">$key</span>,<br />
&nbsp; &nbsp; <a href="http://www.bradino.com/php-functions/array/"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"To"</span> =&amp;gt; <span style="color:#FF0000;">"nighthawk@example.com"</span>, <span style="color:#FF9933; font-style:italic;">// keyed syntax</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">"From: HQ &amp;lt;hq@example.com&amp;gt;"</span>, <span style="color:#FF9933; font-style:italic;">// indexed syntax</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF0000;">"Subject"</span> =&amp;gt; <span style="color:#FF0000;">"Eyes only"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// message encrypted - send it!</span><br />
&nbsp; &nbsp; <a href="http://www.bradino.com/php-functions/exec/"><span style="color:#000066;">exec</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.bradino.com/php-functions/ini_get/"><span style="color:#000066;">ini_get</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"sendmail_path"</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">" &amp;lt;enc.txt"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</div>
</div>
<p></p>
<p>    </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/openssl_pkcs7_encrypt/" rel="tag">openssl_pkcs7_encrypt</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/openssl_pkcs7_encrypt function/" rel="tag">openssl_pkcs7_encrypt function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP openssl_pkcs7_encrypt function/" rel="tag">PHP openssl_pkcs7_encrypt function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;t=PHP%20openssl_pkcs7_encrypt%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;h=PHP%20openssl_pkcs7_encrypt%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20openssl_pkcs7_encrypt%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;=PHP%20openssl_pkcs7_encrypt%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;t=PHP%20openssl_pkcs7_encrypt%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=openssl_pkcs7_encrypt%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.0.6%2C%20PHP%205%29openssl_pkcs7_encrypt%20--%20Encrypt%20an%20S%2FMIME%20messageDescriptionbool%20openssl_pkcs7_encrypt%20%28%20string%20infile%2C%20string%20outfile%2C%20mixed%20recipcerts%2C%20array%20headers%20%5B%2C%20int%20flags%20%5B%2C%20int%20cipherid%5D%5D%20%29%26%2313%3B%20%20%20%20%20ope" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;t=PHP%20openssl_pkcs7_encrypt%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;title=PHP%20openssl_pkcs7_encrypt%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F&amp;submitHeadline=PHP%20openssl_pkcs7_encrypt%20function&amp;submitSummary=openssl_pkcs7_encrypt%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.0.6%2C%20PHP%205%29openssl_pkcs7_encrypt%20--%20Encrypt%20an%20S%2FMIME%20messageDescriptionbool%20openssl_pkcs7_encrypt%20%28%20string%20infile%2C%20string%20outfile%2C%20mixed%20recipcerts%2C%20array%20headers%20%5B%2C%20int%20flags%20%5B%2C%20int%20cipherid%5D%5D%20%29%26%2313%3B%20%20%20%20%20ope&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20openssl_pkcs7_encrypt%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fopenssl_pkcs7_encrypt%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/openssl_pkcs7_encrypt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP pg_escape_bytea function</title>
		<link>http://www.bradino.com/php-functions/pg_escape_bytea/</link>
		<comments>http://www.bradino.com/php-functions/pg_escape_bytea/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 04:30:42 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[pg_escape_bytea    (PHP 4 &#62;= 4.2.0, PHP 5)pg_escape_bytea --
   Escape a string for insertion into a bytea field
  Descriptionstring pg_escape_bytea ( string data )&#13;   pg_escape_bytea() escapes string for
   bytea datatype.  It returns escaped string.
  Note:
    When you SELECT a bytea type, [...]]]></description>
			<content:encoded><![CDATA[<p>pg_escape_bytea<P>    (PHP 4 &#62;= 4.2.0, PHP 5)</P>pg_escape_bytea --<br />
   Escape a string for insertion into a bytea field<br />
  Descriptionstring pg_escape_bytea ( string data )<BR></BR><P>&#13;   pg_escape_bytea() escapes string for<br />
   bytea datatype.  It returns escaped string.<br />
  </P><P>Note:<br />
    When you SELECT a bytea type, PostgreSQL returns octal byte values<br />
    prefixed with '\' (e.g. \032). Users are supposed to convert back to<br />
    binary format manually.<br />
   </P><P>&#13;    This function requires PostgreSQL 7.2 or later. With PostgreSQL<br />
    7.2.0 and 7.2.1, bytea values must be cast when you enable<br />
    multi-byte support. i.e. INSERT INTO test_table (image)<br />
    VALUES ('$image_escaped'::bytea); PostgreSQL 7.2.2 or<br />
    later does not need a cast. The exception is when the client and backend<br />
    character encoding does not match, and there may be multi-byte<br />
    stream error. User must then cast to bytea to avoid this error.<br />
   </P>Parameters<P>&#13;   <P></P>data<P>&#13;       A string containing text or binary data to be inserted into a bytea<br />
       column.<br />
      </P><br />
  </P>Return Values<P>&#13;   A string containing the escaped data.<br />
  </P>Examples<P>&#13;   <P>Example 1. pg_escape_bytea() example</P></p>
<div class="syntax_hilite">
<div id="php-22">
<div class="php"><span style="color:#FF9933; font-style:italic;">// Connect to the database</span><br />
&nbsp; <span style="color:#0000FF;">$dbconn</span> = <a href="http://www.bradino.com/php-functions/pg_connect/"><span style="color:#000066;">pg_connect</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'dbname=foo'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <br />
&nbsp; <span style="color:#FF9933; font-style:italic;">// Read in a binary file</span><br />
&nbsp; <span style="color:#0000FF;">$data</span> = <a href="http://www.bradino.com/php-functions/file_get_contents/"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'image1.jpg'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <br />
&nbsp; <span style="color:#FF9933; font-style:italic;">// Escape the binary data</span><br />
&nbsp; <span style="color:#0000FF;">$escaped</span> = <a href="http://www.bradino.com/php-functions/pg_escape_bytea/"><span style="color:#000066;">pg_escape_bytea</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <br />
&nbsp; <span style="color:#FF9933; font-style:italic;">// Insert it into the database</span><br />
&nbsp; <a href="http://www.bradino.com/php-functions/pg_query/"><span style="color:#000066;">pg_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"INSERT INTO gallery (name, data) VALUES ('Pine trees', '{$escaped}')"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>  </P>See Also<P>&#13;   <P></P>pg_unescape_bytea()pg_escape_string()<P></P><br />
  </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/pg_escape_bytea/" rel="tag">pg_escape_bytea</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/pg_escape_bytea function/" rel="tag">pg_escape_bytea function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP pg_escape_bytea function/" rel="tag">PHP pg_escape_bytea function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;t=PHP%20pg_escape_bytea%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;h=PHP%20pg_escape_bytea%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20pg_escape_bytea%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;=PHP%20pg_escape_bytea%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;t=PHP%20pg_escape_bytea%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=pg_escape_bytea%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.2.0%2C%20PHP%205%29pg_escape_bytea%20--%20%0A%20%20%20Escape%20a%20string%20for%20insertion%20into%20a%20bytea%20field%0A%20%20Descriptionstring%20pg_escape_bytea%20%28%20string%20data%20%29%26%2313%3B%20%20%20pg_escape_bytea%28%29%20escapes%20string%20for%0A%20%20%20bytea%20datatype.%20%20It%20returns%20escap" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;t=PHP%20pg_escape_bytea%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;title=PHP%20pg_escape_bytea%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F&amp;submitHeadline=PHP%20pg_escape_bytea%20function&amp;submitSummary=pg_escape_bytea%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.2.0%2C%20PHP%205%29pg_escape_bytea%20--%20%0A%20%20%20Escape%20a%20string%20for%20insertion%20into%20a%20bytea%20field%0A%20%20Descriptionstring%20pg_escape_bytea%20%28%20string%20data%20%29%26%2313%3B%20%20%20pg_escape_bytea%28%29%20escapes%20string%20for%0A%20%20%20bytea%20datatype.%20%20It%20returns%20escap&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20pg_escape_bytea%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_bytea%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/pg_escape_bytea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP pg_escape_string function</title>
		<link>http://www.bradino.com/php-functions/pg_escape_string/</link>
		<comments>http://www.bradino.com/php-functions/pg_escape_string/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 04:30:41 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[pg_escape_string    (PHP 4 &#62;= 4.2.0, PHP 5)pg_escape_string --
   Escape a string for insertion into a text field
  Descriptionstring pg_escape_string ( string data )&#13;   pg_escape_string() escapes a string for
   insertion into the database.  It returns an escaped string in the
   PostgreSQL format. Use [...]]]></description>
			<content:encoded><![CDATA[<p>pg_escape_string<P>    (PHP 4 &#62;= 4.2.0, PHP 5)</P>pg_escape_string --<br />
   Escape a string for insertion into a text field<br />
  Descriptionstring pg_escape_string ( string data )<BR></BR><P>&#13;   pg_escape_string() escapes a string for<br />
   insertion into the database.  It returns an escaped string in the<br />
   PostgreSQL format. Use of this function is recommended instead of<br />
   addslashes().  If the type of the column<br />
   is bytea, pg_escape_bytea() must be used<br />
   instead.<br />
  </P><P>Note:<br />
    This function requires PostgreSQL 7.2 or later.<br />
    </P>Parameters<P>&#13;   <P></P>data<P>&#13;       A string containing text to be escaped.<br />
      </P><br />
  </P>Return Values<P>&#13;   A string containing the escaped data.<br />
  </P>Examples<P>&#13;   <P>Example 1. pg_escape_string() example</P></p>
<div class="syntax_hilite">
<div id="php-24">
<div class="php"><span style="color:#FF9933; font-style:italic;">// Connect to the database</span><br />
&nbsp; <span style="color:#0000FF;">$dbconn</span> = <a href="http://www.bradino.com/php-functions/pg_connect/"><span style="color:#000066;">pg_connect</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'dbname=foo'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <br />
&nbsp; <span style="color:#FF9933; font-style:italic;">// Read in a text file (containing apostrophes and backslashes)</span><br />
&nbsp; <span style="color:#0000FF;">$data</span> = <a href="http://www.bradino.com/php-functions/file_get_contents/"><span style="color:#000066;">file_get_contents</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'letter.txt'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <br />
&nbsp; <span style="color:#FF9933; font-style:italic;">// Escape the text data</span><br />
&nbsp; <span style="color:#0000FF;">$escaped</span> = <a href="http://www.bradino.com/php-functions/pg_escape_string/"><span style="color:#000066;">pg_escape_string</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;<br />
&nbsp; <br />
&nbsp; <span style="color:#FF9933; font-style:italic;">// Insert it into the database</span><br />
&nbsp; <a href="http://www.bradino.com/php-functions/pg_query/"><span style="color:#000066;">pg_query</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"INSERT INTO correspondence (name, data) VALUES ('My letter', '{$escaped}')"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p>  </P>See Also<P>&#13;   <P></P>pg_escape_bytea()<P></P><br />
  </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/pg_escape_string/" rel="tag">pg_escape_string</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/pg_escape_string function/" rel="tag">pg_escape_string function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP pg_escape_string function/" rel="tag">PHP pg_escape_string function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;t=PHP%20pg_escape_string%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;h=PHP%20pg_escape_string%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20pg_escape_string%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;=PHP%20pg_escape_string%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;t=PHP%20pg_escape_string%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=pg_escape_string%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.2.0%2C%20PHP%205%29pg_escape_string%20--%20%0A%20%20%20Escape%20a%20string%20for%20insertion%20into%20a%20text%20field%0A%20%20Descriptionstring%20pg_escape_string%20%28%20string%20data%20%29%26%2313%3B%20%20%20pg_escape_string%28%29%20escapes%20a%20string%20for%0A%20%20%20insertion%20into%20the%20database." title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;t=PHP%20pg_escape_string%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;title=PHP%20pg_escape_string%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F&amp;submitHeadline=PHP%20pg_escape_string%20function&amp;submitSummary=pg_escape_string%20%20%20%20%28PHP%204%20%26%2362%3B%3D%204.2.0%2C%20PHP%205%29pg_escape_string%20--%20%0A%20%20%20Escape%20a%20string%20for%20insertion%20into%20a%20text%20field%0A%20%20Descriptionstring%20pg_escape_string%20%28%20string%20data%20%29%26%2313%3B%20%20%20pg_escape_string%28%29%20escapes%20a%20string%20for%0A%20%20%20insertion%20into%20the%20database.&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20pg_escape_string%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Fpg_escape_string%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/pg_escape_string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP readfile function</title>
		<link>http://www.bradino.com/php-functions/readfile/</link>
		<comments>http://www.bradino.com/php-functions/readfile/#comments</comments>
		<pubDate>Mon, 26 Feb 2007 04:25:09 +0000</pubDate>
		<dc:creator>BRADINO</dc:creator>
				<category><![CDATA[PHP Functions]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[readfile    (PHP 3, PHP 4, PHP 5)readfile -- Outputs a fileDescriptionint readfile ( string filename [, bool use_include_path [, resource context]] )&#13;   Reads a file and writes it to the output buffer.
  &#13;   Returns the number of bytes read from the file. If an error
   [...]]]></description>
			<content:encoded><![CDATA[<p>readfile<P>    (PHP 3, PHP 4, PHP 5)</P>readfile -- Outputs a fileDescriptionint readfile ( string filename [, bool use_include_path [, resource context]] )<BR></BR><P>&#13;   Reads a file and writes it to the output buffer.<br />
  </P><P>&#13;   Returns the number of bytes read from the file. If an error<br />
   occurs, FALSE is returned and unless the function was called as<br />
   @readfile(), an error message is printed.<br />
  </P><P>Tip: You can use a URL as a<br />
filename with this function if the fopen wrappers have been enabled.<br />
See fopen() for more details on how to specify<br />
the filename and Appendix N for a list of supported<br />
URL protocols.</P><P>&#13;   You can use the optional second parameter and set it to TRUE, if<br />
   you want to search for the file in the include_path, too.<br />
  </P><P>Note: Context support was added<br />
with PHP 5.0.0. For a description of contexts, refer to<br />
Reference CLVIII, Stream Functions.</P><P>&#13;   See also fpassthru(),<br />
   file(), fopen(),<br />
   include(), require(),<br />
   virtual(), file_get_contents(),<br />
   and Appendix N.<br />
  </P></p>
<div class="awmp_tags"><a href="http://www.bradino.com/search/readfile/" rel="tag">readfile</a> <a href="http://www.bradino.com/search/PHP/" rel="tag">PHP</a> <a href="http://www.bradino.com/search/readfile function/" rel="tag">readfile function</a> <a href="http://www.bradino.com/search/php functions/" rel="tag">php functions</a> <a href="http://www.bradino.com/search/PHP readfile function/" rel="tag">PHP readfile function</a> <a href="http://www.bradino.com/search/mysql/" rel="tag">mysql</a> <a href="http://www.bradino.com/search/php tutorials/" rel="tag">php tutorials</a> <a href="http://www.bradino.com/search/apache/" rel="tag">apache</a> <a href="http://www.bradino.com/search/php manual/" rel="tag">php manual</a> <a href="http://www.bradino.com/search/server/" rel="tag">server</a> <a href="http://www.bradino.com/search/database/" rel="tag">database</a> <a href="http://www.bradino.com/search/flash/" rel="tag">flash</a> <a href="http://www.bradino.com/search/content management system/" rel="tag">content management system</a> <a href="http://www.bradino.com/search/sql/" rel="tag">sql</a> <a href="http://www.bradino.com/search/script/" rel="tag">script</a> <a href="http://www.bradino.com/search/string/" rel="tag">string</a> <a href="http://www.bradino.com/search/xml/" rel="tag">xml</a> <a href="http://www.bradino.com/search/regular expressions/" rel="tag">regular expressions</a> <a href="http://www.bradino.com/search/php5/" rel="tag">php5</a> <a href="http://www.bradino.com/search/code/" rel="tag">code</a> <a href="http://www.bradino.com/search/classes/" rel="tag">classes</a> <a href="http://www.bradino.com/search/developers/" rel="tag">developers</a></div>
<div class="sociable">

<ul>
	<li><a rel="nofollow" target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Digg"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://twitter.com/home?status=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F" title="TwitThis"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/twitter.gif" title="TwitThis" alt="TwitThis" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://del.icio.us/post?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="del.icio.us"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.netvouz.com/action/submitBookmark?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function&amp;popup=no" title="Netvouz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/netvouz.png" title="Netvouz" alt="Netvouz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.dzone.com/links/add.html?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="description"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/dzone.png" title="description" alt="description" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Reddit"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.furl.net/storeIt.jsp?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;t=PHP%20readfile%20function" title="Furl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/furl.png" title="Furl" alt="Furl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.newsvine.com/_tools/seed&amp;save?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;h=PHP%20readfile%20function" title="NewsVine"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/newsvine.png" title="NewsVine" alt="NewsVine" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.simpy.com/simpy/LinkAdd.do?href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Simpy"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/simpy.png" title="Simpy" alt="Simpy" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://slashdot.org/bookmark.pl?title=PHP%20readfile%20function&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F" title="Slashdot"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/slashdot.png" title="Slashdot" alt="Slashdot" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.spurl.net/spurl.php?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Spurl"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/spurl.png" title="Spurl" alt="Spurl" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="StumbleUpon"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;=PHP%20readfile%20function" title="YahooMyWeb"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoomyweb.png" title="YahooMyWeb" alt="YahooMyWeb" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://tailrank.com/share/?text=&amp;link_href=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="TailRank"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/tailrank.png" title="TailRank" alt="TailRank" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F" title="Technorati"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;t=PHP%20readfile%20function" title="Facebook"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Google"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google" alt="Google" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function&amp;source=BRADINO+LAMP+Development+Tutorials%2C+Code%2C+Tips+%26amp%3B+Tricks&amp;summary=readfile%20%20%20%20%28PHP%203%2C%20PHP%204%2C%20PHP%205%29readfile%20--%20Outputs%20a%20fileDescriptionint%20readfile%20%28%20string%20filename%20%5B%2C%20bool%20use_include_path%20%5B%2C%20resource%20context%5D%5D%20%29%26%2313%3B%20%20%20Reads%20a%20file%20and%20writes%20it%20to%20the%20output%20buffer.%0A%20%20%26%2313%3B%20%20%20Returns%20the%20number%20of%20bytes%20read%20f" title="LinkedIn"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/linkedin.png" title="LinkedIn" alt="LinkedIn" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Live"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;t=PHP%20readfile%20function" title="MySpace"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/myspace.png" title="MySpace" alt="MySpace" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;title=PHP%20readfile%20function" title="Ping.fm"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/ping.gif" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F&amp;submitHeadline=PHP%20readfile%20function&amp;submitSummary=readfile%20%20%20%20%28PHP%203%2C%20PHP%204%2C%20PHP%205%29readfile%20--%20Outputs%20a%20fileDescriptionint%20readfile%20%28%20string%20filename%20%5B%2C%20bool%20use_include_path%20%5B%2C%20resource%20context%5D%5D%20%29%26%2313%3B%20%20%20Reads%20a%20file%20and%20writes%20it%20to%20the%20output%20buffer.%0A%20%20%26%2313%3B%20%20%20Returns%20the%20number%20of%20bytes%20read%20f&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/yahoobuzz.gif" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a></li>
	<li><a rel="nofollow" target="_blank" href="mailto:?subject=PHP%20readfile%20function&amp;body=http%3A%2F%2Fwww.bradino.com%2Fphp-functions%2Freadfile%2F" title="E-mail this story to a friend!"><img src="http://www.bradino.com/wp-content/plugins/sociable/images/email_link.png" title="E-mail this story to a friend!" alt="E-mail this story to a friend!" class="sociable-hovers" /></a></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bradino.com/php-functions/readfile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
