<?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>SupremeTechs &#187; simplexml_load_file error</title>
	<atom:link href="http://supremetechs.com/tag/simplexml_load_file-error/feed/" rel="self" type="application/rss+xml" />
	<link>http://supremetechs.com</link>
	<description>Anything and everything techy</description>
	<lastBuildDate>Sun, 05 Feb 2012 10:43:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration</title>
		<link>http://supremetechs.com/2009/09/24/warning-simplexmlloadfile-functionsimplexmlloadfile-url-fileaccess-disabled-server-configuration/</link>
		<comments>http://supremetechs.com/2009/09/24/warning-simplexmlloadfile-functionsimplexmlloadfile-url-fileaccess-disabled-server-configuration/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 19:28:17 +0000</pubDate>
		<dc:creator>Randy</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[file-access is disabled on the server]]></category>
		<category><![CDATA[function.simplexml-load-file]]></category>
		<category><![CDATA[simplexml_load_file error]]></category>

		<guid isPermaLink="false">http://supremetechs.com/wordpress/?p=423</guid>
		<description><![CDATA[If you've seen that error message you've probably happened upon a security feature that your shared web hosting provider has enabled. There are a few work-arounds for this error but most require you to have certain privileges on the server that you probably don't have. Quite frankly, if you are getting these errors you probably [...]<p><a href="http://supremetechs.com/2009/09/24/warning-simplexmlloadfile-functionsimplexmlloadfile-url-fileaccess-disabled-server-configuration/">Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration</a> is a post from: <a href="http://supremetechs.com">SupremeTechs</a></p>
]]></description>
			<content:encoded><![CDATA[<p>If you've seen that error message you've probably happened upon a security feature that your shared web hosting provider has enabled. There are a few work-arounds for this error but most require you to have certain privileges on the server that you probably don't have. Quite frankly, if you are getting these errors you probably don't have the ability to change these settings yourself.</p>
<p>Rather than try to get the provider to change these settings (let's face it, they have this enabled for a reason and surely someone else has already tried to get this changed, right?) one can easily get around this with Curl. In most cases, curl will be enabled on the server. So here is the quick and dirty way to get around it:</p>
<p>Create a PHP file and name it anything you want. For the sake of this article we'll refer to it as curl_functions.php. In this file put the following functions:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>php
<span style="color: #000000; font-weight: bold;">function</span> setupMyCurl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000088;">$myCurl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
   <span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myCurl</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$myCurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;myCurl&quot;</span><span style="color: #339933;">,</span> setupMyCurl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> curl_get_contents<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000088;">$temp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span>myCurl<span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #b1b100;">return</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span>myCurl<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Include or require this file. Then, all you have to do is use the <code>curl_get_contents($url)</code> in your code to pull in the xml to a string. Then use the <code>simplexml_load_string()</code> instead of <code>simplexml_load_file()</code>. This will give you the same results but works around the url fopen feature. If you don't have curl enabled on your host, GET ANOTHER HOST. <img src='http://supremetechs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://supremetechs.com/2009/09/24/warning-simplexmlloadfile-functionsimplexmlloadfile-url-fileaccess-disabled-server-configuration/">Warning: simplexml_load_file() [function.simplexml-load-file]: URL file-access is disabled in the server configuration</a> is a post from: <a href="http://supremetechs.com">SupremeTechs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://supremetechs.com/2009/09/24/warning-simplexmlloadfile-functionsimplexmlloadfile-url-fileaccess-disabled-server-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

