<?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>cablop.net - Software Tips &#187; cURL</title>
	<atom:link href="http://sw.cablop.net/tips/tag/curl/feed/" rel="self" type="application/rss+xml" />
	<link>http://sw.cablop.net/tips</link>
	<description>Tips de software, hardware... y algo más</description>
	<lastBuildDate>Fri, 05 Feb 2010 16:50:02 +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>Warning:  URL file-access is disabled in the server configuration</title>
		<link>http://sw.cablop.net/tips/2009/08/29/warning-url-file-access-is-disabled-in-the-server-configuration/</link>
		<comments>http://sw.cablop.net/tips/2009/08/29/warning-url-file-access-is-disabled-in-the-server-configuration/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 16:44:59 +0000</pubDate>
		<dc:creator>天龙</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[file-access]]></category>
		<category><![CDATA[php.ini]]></category>

		<guid isPermaLink="false">http://sw.cablop.net/tips/?p=86</guid>
		<description><![CDATA[Este caso se me presentó con un línea del siguiente estilo:
$response=file_get_contents("http://web.com/contenido.xml");
Y no se podía solucionar con el archivo php.ini ni con la variable allow_url_fopen = On ni con allow_url_include = On.
Entonces, ¿cómo se soluciona?
Sí se tiene cURL en el servidor pues lo podemos solucionar de la siguiente manera:
$fileURL = "http://pagina.web/.../archivo";
		$ch = curl_init($fileURL);
		$file = "/ruta/a/temporales/temporal" . [...]]]></description>
			<content:encoded><![CDATA[<p>Este caso se me presentó con un línea del siguiente estilo:</p>
<p style="padding-left: 30px"><code><span style="color: #000080">$response=file_get_contents("http://web.com/contenido.xml");</span></code></p>
<p>Y no se podía solucionar con el archivo <em><span style="color: #339966">php.ini</span></em> ni con la variable <em><span style="color: #000080">allow_url_fopen = On</span></em> ni con <span style="color: #000080"><em>allow_url_include = On</em></span>.</p>
<p>Entonces, ¿cómo se soluciona?</p>
<p>Sí se tiene cURL en el servidor pues lo podemos solucionar de la siguiente manera:</p>
<p style="padding-left: 30px"><code><span style="color: #000080">$fileURL = "http://pagina.web/.../archivo";<br />
		$ch = curl_init($fileURL);<br />
		$file = "/ruta/a/temporales/temporal" . time();<br />
		$fp = @fopen($file, "w");<br />
		curl_setopt($ch, CURLOPT_FILE, $fp);<br />
		curl_setopt($ch, CURLOPT_HEADER, 0);<br />
		curl_exec($ch);<br />
		curl_close($ch);<br />
		fclose($fp);<br />
		$response = file_get_contents($file);<br />
		unlink($file);</span></code></p>
<p>Naturalmente tenemos que contar con que cURL esté correctamente configurado y que tengamos permiso de escritura del archivo &#8220;temporal&#8221; (o el nombre que le hayamos querido dar).</p>
]]></content:encoded>
			<wfw:commentRss>http://sw.cablop.net/tips/2009/08/29/warning-url-file-access-is-disabled-in-the-server-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
