<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Latest snippets tagged allowurlfopen</title>
  <link rel="alternate" href="http://snippets.prendreuncafe.com/snippets/tagged/allowurlfopen/order_by/date"></link>
  <id>http://snippets.prendreuncafe.com/snippets/tagged/allowurlfopen/order_by/date</id>
  <updated>2008-05-13T21:22:11Z</updated>
  <author>
    <name>Symfony</name>
    <author_email>noreply@symfony-project.com</author_email>
  </author>
<entry>
  <title>Passer outre le &quot;allow_url_fopen et allow_url_include&quot; a Off</title>
  <link href="http://snippets.prendreuncafe.com/snippet/91"></link>
  <updated>2008-05-13T21:22:11Z</updated>
  <id>91</id>
  <summary type="html">Qui n'a jamais eu un Warning de type : 
&quot;file_get_contents() function.file-get-contents: URL file-access is disabled in the server configuration in % on line %&quot;  sur un hebergement mutualisé ? 

la solution et d'utiliser lynx en ligne de commande pour attaquer une url, on utilisera la fonction exec(), exemple avec l'api GoogleMaps

[code]
&lt;?php

define('GOOGLE_API_KEY', 'your_google_api_key_here');
$wsurl = 'http://maps.google.com/maps/geo?q=%s&amp;output=csv&amp;key=%s';
$location = 'Paris, France';

$data = explode(',', exec('lynx --dump \''.sprintf($wsurl, urlencode($location), GOOGLE_API_KEY).'\''));
/*** Au lieu de ***/
$data = explode(',', file_get_contents(sprintf($wsurl, urlencode($location), GOOGLE_API_KEY)));


$coord = 200 === (int)$data[0] ? array((float)$data[2], (float)$data[3]) : null;
var_dump($coord);
?&gt;

[/code]</summary>
</entry>
</feed>
