<?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>miniblog &#187; PHP</title>
	<atom:link href="http://pas-bien.net/blog/mot-clef/php/feed" rel="self" type="application/rss+xml" />
	<link>http://pas-bien.net/blog</link>
	<description>encore un blog de geek</description>
	<lastBuildDate>Mon, 23 Apr 2012 21:40:42 +0000</lastBuildDate>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Flux RSS des Vie de merde illustrées [UPDATE]</title>
		<link>http://pas-bien.net/blog/2009/02/16/flux-rss-des-vie-de-merde-illustrees-157</link>
		<comments>http://pas-bien.net/blog/2009/02/16/flux-rss-des-vie-de-merde-illustrees-157#comments</comments>
		<pubDate>Mon, 16 Feb 2009 19:04:51 +0000</pubDate>
		<dc:creator>mini</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[illustration]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[VDM]]></category>
		<category><![CDATA[Vie de merde]]></category>

		<guid isPermaLink="false">http://pas-bien.net/blog/?p=157</guid>
		<description><![CDATA[Le site VDM.fr doit être maintenant assez célébre pour que je prenne pas la peine de le présenter. Sur le site régulièrement des illustrations de VDM sont ajoutées. Elles sont ]]></description>
			<content:encoded><![CDATA[<p><!--:fr-->Le site <a href="http://www.viedemerde.fr/">VDM.fr</a> doit être maintenant assez célébre pour que je prenne pas la peine de le présenter. Sur le site régulièrement des illustrations de VDM sont ajoutées. Elles sont souvant sympa mais mon problème c&#8217;était que je les voyais pas : elle sont pas dans le flux RSS.</p>
<p>Donc si j&#8217;utilise les flux RSS c&#8217;est bien pour ne pas aller sur des sites. Donc mon problème était qu&#8217;il n&#8217;y avait pas de flux avec les illustrations.</p>
<p style="text-align: center;">***</p>
<p><span style="text-decoration: line-through;">Donc pour résoudre mon problème j&#8217;ai fait un petit script PHP qui fouille dans la page <a href="http://www.viedemerde.fr/illustrations">http://www.viedemerde.fr/illustrations</a> et génére un flux à partir des données trouvées.<br />
Pour l&#8217;utiliser voilà où ça se trouve :</span> <p style="border-top: 2px solid rgb(65, 105, 175); border-bottom: 2px solid rgb(65, 105, 175); padding: 5px 20px 5px 45px; background: rgb(223, 235, 255) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/world.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><span style="text-decoration: line-through;"><a href="http://pas-bien.net/divers/rss-vdm-illustratee/">http://pas-bien.net/divers/rss-vdm-illustratee/</a></span></p><span style="text-decoration: line-through;"> Sources dispo pour ceux qui veulent : </span><p style="border-top: 2px solid rgb(192, 192, 192); border-bottom: 2px solid rgb(192, 192, 192); padding: 5px 20px 5px 45px; background: rgb(240, 240, 240) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/download.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><span style="text-decoration: line-through;"><a href="http://pas-bien.net/divers/rss-vdm-illustratee/sources.txt">http://pas-bien.net/divers/rss-vdm-illustratee/sources.txt</a></span></p></p>
<p style="text-align: center;">***</p>
<p style="text-align: left;">Finalement le plus simple est encore de leur demander de l&#8217;ajouter (ce que j&#8217;ai fait) et ils ont gentillement accepté ! Donc voici l&#8217;adresse officielle du flux :</p>
<p style="text-align: left;"><p style="border-top: 2px solid rgb(65, 105, 175); border-bottom: 2px solid rgb(65, 105, 175); padding: 5px 20px 5px 45px; background: rgb(223, 235, 255) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/world.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><a href="http://feeds.feedburner.com/illusdemerde">http://feeds.feedburner.com/illusdemerde</a></p></p>
<p style="text-align: left;">UPDATE (18/11/2010): ajout du lien officiel et suppression de mon script inutile&#8230;</p>
<p><!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://pas-bien.net/blog/2009/02/16/flux-rss-des-vie-de-merde-illustrees-157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extraire des données du cache Firefox</title>
		<link>http://pas-bien.net/blog/2009/02/13/extraire-des-donnees-du-cache-firefox-145</link>
		<comments>http://pas-bien.net/blog/2009/02/13/extraire-des-donnees-du-cache-firefox-145#comments</comments>
		<pubDate>Fri, 13 Feb 2009 16:46:26 +0000</pubDate>
		<dc:creator>mini</dc:creator>
				<category><![CDATA[Projets]]></category>
		<category><![CDATA[about:cache]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[hexdump]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://pas-bien.net/blog/?p=145</guid>
		<description><![CDATA[La fonction about:cache de Firefox (à taper dans la barre d&#8217;adresse) permet d&#8217;afficher les éléments qui ont été mis en cache. Un jour j&#8217;ai eu à récupérer un fichier CSS ]]></description>
			<content:encoded><![CDATA[<p><!--:fr-->La fonction <strong>about:cache</strong> de Firefox (à taper dans la barre d&#8217;adresse) permet d&#8217;afficher les éléments qui ont été mis en cache.  Un jour j&#8217;ai eu à récupérer un fichier CSS que j&#8217;avais supprimé par erreur mais qui était toujours dans le cache. J&#8217;ai donc pu voir mon fichier mais en affichage hexadécimal :</p>
<div id="attachment_146" class="wp-caption aligncenter" style="width: 310px"><a href="http://pas-bien.net/blog/wp-content/uploads/2009/02/aboutcache.gif"><img class="size-medium wp-image-146" title="aboutcache" src="http://pas-bien.net/blog/wp-content/uploads/2009/02/aboutcache-300x246.gif" alt="Affichage d'un fichier du cache Firefox" width="300" height="246" /></a><p class="wp-caption-text">Affichage d&#39;un fichier du cache Firefox</p></div>
<p>Si on fait &laquo;&nbsp;Fichier&nbsp;&raquo; &gt; &laquo;&nbsp;Enregistrer sous&#8230;&nbsp;&raquo; on peut enregistrer ces données dans un fichier (nomé <em>Cache entry information.xhtml</em> par défaut).  J&#8217;ai donc écrit un outil qui permet d&#8217;extraire les données en affichables pour les écrire en binaire. Cet outil est écrit en PHP-CLI (Command Line Interface) et s&#8217;utilise comme ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">php cache2bin.php <span style="color: #ff0000;">&quot;Cache entry information.xhtml&quot;</span> <span style="color: #ff0000;">&quot;test.gif&quot;</span></pre></div></div>

<p>Vous pouvez le télécharger à cette adresse si cela vous intéresse :  <p style="border-top: 2px solid rgb(192, 192, 192); border-bottom: 2px solid rgb(192, 192, 192); padding: 5px 20px 5px 45px; background: rgb(240, 240, 240) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/download.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><a href="http://pas-bien.net/blog/wp-content/uploads/2009/02/cache2bin.txt">cache2bin.txt</a></p></p>
<p><p style="border-top: 2px solid rgb(181, 212, 254); border-bottom: 2px solid rgb(181, 212, 254); padding: 5px 20px 5px 45px; background: rgb(248, 250, 252) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/info.gif) no-repeat scroll 15px 50%;color: rgb(94, 98, 115); text-align: left;">Pour l&#8217;exécuter il faudra surement le renommer en .php et ajouter les droit d&#8217;exécution sur Linux.</p></p>
<h2>Personnalisation</h2>
<p>Si vous avez besoin de faire la même chose mais pour un fichier ne provenant pas du cache de Firefox, ce programme peut marcher en l&#8217;état, mais si ce n&#8217;est pas le cas, il n&#8217;y aura sûrement que deux choses à faire :</p>
<ol>
<li>Remplacer $ereg par l&#8217;expression régulière correspondant à votre fichier.</li>
<li>Remplacer $data_per_line par le nombre d&#8217;octets affichés par ligne.</li>
</ol>
<p>Par exemple pour un fichier généré par la commande Linux hexdump on aurait $data_per_line qui reste à 16 et pour $ereg :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ereg</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/[0-9a-f]{8}: ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) - ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2}) ([0-9A-F ]{2})/&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Licence</h2>
<p style="text-align: center;"><a href="http://creativecommons.org/license/cc-gpl" target="_blank"><img class="size-full wp-image-36 aligncenter" title="Creative Commons GNU GPL" src="http://pas-bien.net/blog/wp-content/uploads/2009/01/cc-gpl-a.png" alt="Creative Commons GNU GPL" width="88" height="62" /></a></p>
<p style="text-align: center;"><a href="http://creativecommons.org/license/cc-gpl">Programme sous Creative Commons GNU GPL</a></p>
<p><!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://pas-bien.net/blog/2009/02/13/extraire-des-donnees-du-cache-firefox-145/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Recevez vos flux RSS Twitter avec Google Reader</title>
		<link>http://pas-bien.net/blog/2009/02/04/recevez-vos-flux-rss-twitter-avec-google-reader-89</link>
		<comments>http://pas-bien.net/blog/2009/02/04/recevez-vos-flux-rss-twitter-avec-google-reader-89#comments</comments>
		<pubDate>Wed, 04 Feb 2009 12:04:15 +0000</pubDate>
		<dc:creator>mini</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Projets]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Google Reader]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://pas-bien.net/blog/?p=89</guid>
		<description><![CDATA[Cet outil ne fonctionne plus. Les flux RSS Twitter sont protégés par des mots de passes, ce qui peut être gênant si votre agrégateur de flux ne supporte pas l&#8217;authentification. ]]></description>
			<content:encoded><![CDATA[<p><!--:fr--><p style="border-top: 2px solid rgb(255, 211, 36); border-bottom: 2px solid rgb(255, 211, 36); padding: 5px 20px 5px 45px; background: rgb(255, 246, 191) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/alert.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(153, 102, 102);">Cet outil ne fonctionne plus.</p></p>
<p>Les <strong>flux RSS Twitter</strong> sont protégés par des mots de passes, ce qui peut être gênant si votre agrégateur de flux <strong>ne supporte pas l&#8217;authentification</strong>. C&#8217;était mon cas avec <strong>Google Reader</strong>.</p>
<p>J&#8217;ai écrit un &laquo;&nbsp;<strong>proxy</strong>&nbsp;&raquo; de flux qui ne nécessite pas d&#8217;authentification au niveau du protocole HTML. L&#8217;authentification sur mon proxy se fait par un paramètre GET et le proxy s&#8217;authentifie sur Twitter.</p>
<p>Il peut sembler risqué de donner un mot de passe à un site aussi peu connu qui le mien et c&#8217;est normal puisque ça l&#8217;est ! Le nom d&#8217;utilisateur et le mot de passe sont codés dans le paramètre <em>key</em>, il n&#8217;est pas inscrit ailleur.</p>
<p>Je peux décoder vos mots de passes sans problème à partir des logs Apache. Mais sérieusement j&#8217;en ai rien à faire de vos comptes Twitter ! Par contre le code source de cet outil ne sera pas révélé pour que le codage reste sûr. Donc même si votre <em>key</em> générée tombe entre les mains de personnes mal intentionnées ils n&#8217;auront accès qu&#8217;à votre flux via mon proxy.</p>
<p>L&#8217;outil est ici:</p>
<p><p style="border-top: 2px solid rgb(65, 105, 175); border-bottom: 2px solid rgb(65, 105, 175); padding: 5px 20px 5px 45px; background: rgb(223, 235, 255) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/world.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><a title="Twitter Feeds Proxy" href="http://pas-bien.net/divers/rss-twitter-proxy/">Twitter Feeds Proxy</a></p></p>
<p>Si vous avec des doutes sur la sécurité de mon outil, le mieux est de ne pas l&#8217;utiliser. <img src='http://pas-bien.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> <!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://pas-bien.net/blog/2009/02/04/recevez-vos-flux-rss-twitter-avec-google-reader-89/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fusionnez deux fichiers SRT avec 2srt2ass</title>
		<link>http://pas-bien.net/blog/2009/02/02/fusionnez-deux-fichiers-srt-avec-2srt2ass-83</link>
		<comments>http://pas-bien.net/blog/2009/02/02/fusionnez-deux-fichiers-srt-avec-2srt2ass-83#comments</comments>
		<pubDate>Mon, 02 Feb 2009 10:07:12 +0000</pubDate>
		<dc:creator>mini</dc:creator>
				<category><![CDATA[Projets]]></category>
		<category><![CDATA[ASS]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[sous titres]]></category>
		<category><![CDATA[SRT]]></category>

		<guid isPermaLink="false">http://pas-bien.net/blog/?p=83</guid>
		<description><![CDATA[Pour travailler mon anglais je voulais pouvoir utiliser deux fichiers SRT en même temps : un en VO et l&#8217;autre en français pour avoir la traduction instantanée. Mes lecteurs vidéos ]]></description>
			<content:encoded><![CDATA[<p>Pour travailler mon anglais je voulais pouvoir utiliser deux fichiers SRT en même temps : un en VO et l&#8217;autre en français pour avoir la traduction instantanée. Mes lecteurs vidéos préférés (Media Player Classic et VLC) ne permettant pas ça : j&#8217;ai créé un petit outil PHP : 2SRT2ASS (ou Two SRT to ASS).</p>
<p>Il analyse les fichiers SRT que l&#8217;on lui envoie pour les ressortir fusionnés en un fichiers ASS. Voici un petit apperçu de ce que ça donne avec Knight Rider 2008 (no comment sur la série <img src='http://pas-bien.net/blog/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' />  ) :</p>
<div id="attachment_84" class="wp-caption aligncenter" style="width: 510px"><a href="http://pas-bien.net/blog/wp-content/uploads/2009/01/2srt2ass.jpg"><img class="size-full wp-image-84" title="2srt2ass" src="http://pas-bien.net/blog/wp-content/uploads/2009/01/2srt2ass.jpg" alt="Aperçu de deux fichiers SRT fusionnés" width="500" height="284" /></a><p class="wp-caption-text">Aperçu de deux fichiers SRT fusionnés</p></div>
<p>Cet outil fonctionne très simplement :</p>
<ol>
<li>Vous lui envoyez les deux fichiers.</li>
<li>Vous cliquez sur &laquo;&nbsp;Envoyer&nbsp;&raquo; et il vous renvoie les fichiers fusionnés.</li>
</ol>
<p>Le fichier généré est un fichier SSA/ASS. C&#8217;était <a title="VLC's Subtitles codecs" href="http://wiki.videolan.org/SubtitlesCodec">le seul format</a> qui permettait d&#8217;avoir une mise en forme (en haut et en bas) tout en étant basé sur les timestamps (comme pour les fichiers SRT).</p>
<p>A noter aussi que VLC semble mal digérer les ASS mais Media Player Classic n&#8217;a aucun problèmes.</p>
<p>Si vous voulez vous aussi utiliser cet outil, il est disponnible avec ses sources ici :</p>
<p><p style="border-top: 2px solid rgb(65, 105, 175); border-bottom: 2px solid rgb(65, 105, 175); padding: 5px 20px 5px 45px; background: rgb(223, 235, 255) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/world.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><a title="2SRT2ASS" href="http://pas-bien.net/2srt2ass/">2SRT2ASS</a></p></p>
<p>PS : Si vous souhaitez attrendre le support de cette fonction dans VLC, <a title="VideoLan Forum : Dual subtitles?" href="http://forum.videolan.org/viewtopic.php?f=7&amp;t=21558&amp;start=0">une discution</a> est en cours depuis 2006&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://pas-bien.net/blog/2009/02/02/fusionnez-deux-fichiers-srt-avec-2srt2ass-83/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Filtrez vos flux RSS avec ce qui vous intéresse</title>
		<link>http://pas-bien.net/blog/2009/01/26/filtrez-vos-flux-rss-avec-ce-qui-vous-interesse-33</link>
		<comments>http://pas-bien.net/blog/2009/01/26/filtrez-vos-flux-rss-avec-ce-qui-vous-interesse-33#comments</comments>
		<pubDate>Mon, 26 Jan 2009 17:37:30 +0000</pubDate>
		<dc:creator>mini</dc:creator>
				<category><![CDATA[Divers]]></category>
		<category><![CDATA[Projets]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://pas-bien.net/blog/?p=33</guid>
		<description><![CDATA[Pour quoi faire ? J&#8217;utilise pas mal les flux RSS pour me simplifier certaines choses. Comme par exemple l&#8217;arrivée d&#8217;un nouvel épisode d&#8217;une des séries que je suis. Un de ]]></description>
			<content:encoded><![CDATA[<p><!--:fr--><br />
<h2>Pour quoi faire ?</h2>
<p>J&#8217;utilise pas mal les flux RSS pour me simplifier certaines choses. Comme par exemple l&#8217;arrivée d&#8217;un nouvel épisode d&#8217;une des séries que je suis. Un de mes &laquo;&nbsp;problèmes&nbsp;&raquo; était que je recevais des actualités dont je n&#8217;avais rien à faire. Je me suis donc créé un petit outil PHP qui récupère les flux RSS de différents sites, les filtre et les regroupe en un seul.</p>
<h2>Comment ça marche ?</h2>
<p>Il y a deux moyens d&#8217;utiliser cet outil.</p>
<h3>Première utilisation</h3>
<p>Avec des paramètres GET :</p>
<ul>
<li>feeds : la liste des flux séparés par une virgule.</li>
<li>filters : la liste des filtres d&#8217;inclusions aussi séparés par une virgule.</li>
<li>excludes (optionnel) : encore une liste séparée par des virgule pour forcer l&#8217;exclusion d&#8217;items qui sont passés.</li>
<li>debug  (optionnel)  : pour recevoir dans le flux généré les erreurs qui se sont produites.</li>
</ul>
<p>Exemple :</p>
<p style="padding-left: 30px;">http://example.com/rss-filter/rssfilter.php?feeds=http://www.toto.com/rssfr.xml,http://www.tata.fr/rss.xml&amp;filters=CSI,CSI Miami,House&amp;exclude=Desperate&amp;debug=1</p>
<h3>Deuxième utilisation</h3>
<p>Avec un fichier XML dans le sous dossier <em>files</em> qui contient la configuration. Les filtres sont des <a href="http://fr3.php.net/manual/fr/regexp.reference.php">expréssions régulières</a>. Exemle de fichier XML :</p>
<p style="padding-left: 30px;">http://example.com/rss-filter/files/series.xml</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?--&gt;</span>
&nbsp;
	[EZTV+VTV+subs] Filtrés
	Séries : Dexter, Dirty Sexy Money, Fringe, Grey's Anatomy, Heroes, House, How I Met Your Mother, Lost, My Name Is Earl, Naruto Shippuuden, The IT Crowd, The United State Of Tara, True Blood, Weeds.
&nbsp;
		<span style="color: #808080; font-style: italic;">&lt;!-- sous titres --&gt;</span>
		http://www.tvsubtitles.net/rssfr.xml
		http://www.sub-way.fr/rss.xml
		http://feeds.feedburner.com/seriessub
		<span style="color: #808080; font-style: italic;">&lt;!-- séries --&gt;</span>
		http://www.mininova.org/rss.xml?user=VTV
		http://www.mininova.org/rss.xml?user=EZTV
		<span style="color: #808080; font-style: italic;">&lt;!-- naruto --&gt;</span>
		http://www.dattebayo-fr.com/rss-news.php
&nbsp;
		/\bDexter\b/i
		/\bDirty Sexy Money\b/i
		/\bFringe\b/i
		/\bGrey'?s? Anatomy\b/i
		/\bHeroes\b/i
		/\bHouse\b/i
		/\bHow I Met Your Mother\b/i
		/\bLost\b/i
		/\bMy Name Is Earl\b/i
		/\bNaruto Shippuuden\b/i
		/\bThe Mentalist\b/i
		/\bThe IT Crowd\b/i
		/\bSons of Anarchy\b/i
		/\bUnited States Of Tara\b/i
		/\bTrue Blood\b/i
		/\bWeeds\b/i
&nbsp;
		/\bCrooked House\b/i
		/\bDesperate Housewives\b/i
		/\bx264\b/i</pre></div></div>

<p>Le flux correspondant sera disponnible comme ceci :</p>
<p style="padding-left: 30px;">http://example.com/rss-filter/rssfilter.php?file=series</p>
<p style="padding-left: 30px;">http://example.com/rss-filter/rssfilter.php?file=series&amp;debug=1 (pour avoir le debug en plus)</p>
<h2>Installation</h2>
<p><p style="border-top: 2px solid rgb(255, 211, 36); border-bottom: 2px solid rgb(255, 211, 36); padding: 5px 20px 5px 45px; background: rgb(255, 246, 191) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/alert.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(153, 102, 102);">Votre navigateur risque d&#8217;essayer de parser le fichier rssfilter.txt en tant que flux RSS.</p>Posez le fichier <a href="http://pas-bien.net/blog/wp-content/uploads/2009/01/rssfilter.txt">rssfilter.php</a> sur un serveur Web qui dispose de :</p>
<ul>
<li>PHP 5,</li>
<li>la fonction file_get_contents,</li>
<li>L&#8217;extension SimpleXML.</li>
</ul>
<p><p style="border-top: 2px solid rgb(192, 192, 192); border-bottom: 2px solid rgb(192, 192, 192); padding: 5px 20px 5px 45px; background: rgb(240, 240, 240) url(http://pas-bien.net/blog/wp-content/plugins/NiceWeb2CSS/icon/download.gif) no-repeat scroll 15px 50%; text-align: left; color: rgb(102, 102, 102);"><a href="http://pas-bien.net/blog/wp-content/uploads/2009/01/rssfilter.txt">Télécharger rssfilter.php</a></p></p>
<h2>Questions ?</h2>
<p>En cas de problème n&#8217;ésitez pas à me poser des questions dans les commentaire <img src='http://pas-bien.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p style="text-align: center;"><a href="http://creativecommons.org/license/cc-gpl" target="_blank"><img class="size-full wp-image-36 aligncenter" title="Creative Commons GNU GPL" src="http://pas-bien.net/blog/wp-content/uploads/2009/01/cc-gpl-a.png" alt="Creative Commons GNU GPL" width="88" height="62" /></a></p>
<p style="text-align: center;"><a href="http://creativecommons.org/license/cc-gpl">Programme sous Creative Commons GNU GPL</a></p>
<p><!--:--></p>
]]></content:encoded>
			<wfw:commentRss>http://pas-bien.net/blog/2009/01/26/filtrez-vos-flux-rss-avec-ce-qui-vous-interesse-33/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilisation avancée de file_get_contents (PHP)</title>
		<link>http://pas-bien.net/blog/2007/12/21/utilisation-avancee-de-file_get_contents-php-5</link>
		<comments>http://pas-bien.net/blog/2007/12/21/utilisation-avancee-de-file_get_contents-php-5#comments</comments>
		<pubDate>Fri, 21 Dec 2007 09:54:13 +0000</pubDate>
		<dc:creator>mini</dc:creator>
				<category><![CDATA[Notes Techniques]]></category>
		<category><![CDATA[authentification]]></category>
		<category><![CDATA[file_get_contents]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://pas-bien.net/blog/utilisation-avancee-de-file_get_contents-php</guid>
		<description><![CDATA[Préambule Je fais cette note technique car je me suis plus d&#8217;une fois confronté à différentes configurations pour accéder à une page Web à partir de PHP. Normalement un serveur ]]></description>
			<content:encoded><![CDATA[<h2>Préambule</h2>
<p>Je fais cette note technique car je me suis plus d&#8217;une fois confronté à différentes configurations pour accéder à une page Web à partir de PHP. Normalement un serveur Web dispose d&#8217;une connection directe à internet et n&#8217;a pas besoin d&#8217;un proxy pour y acceder. Mais si on fait des script PHP en CLI (non liès à un serveur Web) on peut se trouver confronter à différents problèmes&#8230;</p>
<h2>Cas 1 : la simplicité même</h2>
<p>Voici le cas le plus simple pour récupérer un page à partir de son URL. Dnas le cas où PHP dispose d&#8217;un accès direct à internet.</p>
<h3>HTTP</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.google.com/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>HTTPS</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;https://www.google.com/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Si il vous manque l&#8217;extension <em>open_ssl</em> vous aurez une erreur dans ce genre :</p>
<pre>Notice: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in ...\test_001.php on line 3

Warning: file_get_contents(https://www.google.com/): failed to open stream: Invalid argument in ...\test_001.php on line 3</pre>
<p>C&#8217;est aussi valable pour les cas suivants.</p>
<h2>Cas 2 : Authentification HTML</h2>
<p>Si la page est protégée par un mot de passe, PHP peut transformer une URL avec utilisateur et mot de passe pour envoyer la requête avec les bons headers.</p>
<h3>HTTP</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://user:pass@www.example.com/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>HTTPS</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;https://user:pass@www.example.com/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Méthode alternative</h3>
<p>Vous pouvez aussi envoyer vous même les headers contenant mots de passe et utilisateur. C&#8217;est plus compliqué mais ça marche aussi.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// URL des données à récupérer</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://protectedstuff.com'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Encodage de l'autentification</span>
<span style="color: #000088;">$auth</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user:password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création des options de la requête</span>
<span style="color: #000088;">$opts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'http'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'method'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Authorization: Basic <span style="color: #006699; font-weight: bold;">$auth</span>&quot;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'https'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'method'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Authorization: Basic <span style="color: #006699; font-weight: bold;">$auth</span>&quot;</span>
	<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création du contexte de transaction</span>
<span style="color: #000088;">$ctx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$opts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Récupération des données</span>
<span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #000088;">$ctx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Source : <a href="http://fr.php.net/manual/fr/function.stream-context-create.php#74431" target="_blank">http://fr.php.net/manual/fr/function.stream-context-create.php#74431</a></p>
<h2>Cas 3 : En passant par un proxy</h2>
<p>Il m&#8217;est arrivé d&#8217;écrire des script en PHP-CLI qui se retrouvaient bloqués par un proxy.</p>
<h3>HTTP ou HTTPS</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// URL des données à récupérer</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'https://www.google.com/'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création des options de la requête</span>
<span style="color: #000088;">$opts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'http'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'https'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span>
	<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création du contexte de transaction</span>
<span style="color: #000088;">$ctx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$opts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Récupération des données</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #000088;">$ctx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Cas 4 : Proxy et page avec authentification HTML</h2>
<p>Si en plus la page que vous souhaitez télécharger requière une authentification, cela reste simple.</p>
<h3>HTTP ou HTTPS</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// URL des données à récupérer</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'https://user:pass@www.example.com/'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création des options de la requête</span>
<span style="color: #000088;">$opts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'http'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'https'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span>
	<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création du contexte de transaction</span>
<span style="color: #000088;">$ctx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$opts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Récupération des données</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #000088;">$ctx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Cas 5 : Proxy avec authentification</h2>
<p>Dans certaines entreprises ou administration on peut se trouver derrière un proxy qui filtre les utilisateurs. Voici comment faire passer son script.</p>
<h3>HTTP ou HTTPS</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// URL des données à récupérer</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.example.com/'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Encodage de l'autentification</span>
<span style="color: #000088;">$authProxy</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user:pass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création des options de la requête</span>
<span style="color: #000088;">$opts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'http'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'method'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Proxy-Authorization: Basic <span style="color: #006699; font-weight: bold;">$authProxy</span>&quot;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'https'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'method'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Proxy-Authorization: Basic <span style="color: #006699; font-weight: bold;">$authProxy</span>&quot;</span>
	<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création du contexte de transaction</span>
<span style="color: #000088;">$ctx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$opts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Récupération des données</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #000088;">$ctx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Cas 6 : Proxy avec authentification et page avec authentification</h2>
<p>Voici un des cas les plus complexes lorqu&#8217;il est question de récupérer des données. J&#8217;ai rencontré ce problème lorsque j&#8217;ai fait un script pour récupérer mes logs chez OVH.</p>
<h3>HTTP ou HTTPS</h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// URL des données à récupérer</span>
<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'https://user:pass@www.example.com/'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Encodage de l'autentification</span>
<span style="color: #000088;">$authProxy</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user:pass'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création des options de la requête</span>
<span style="color: #000088;">$opts</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'http'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'method'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Proxy-Authorization: Basic <span style="color: #006699; font-weight: bold;">$authProxy</span>&quot;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'https'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'method'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'GET'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'proxy'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'tcp://192.168.0.99:3128'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'request_fulluri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'header'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;Proxy-Authorization: Basic <span style="color: #006699; font-weight: bold;">$authProxy</span>&quot;</span>
	<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Création du contexte de transaction</span>
<span style="color: #000088;">$ctx</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stream_context_create</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$opts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Récupération des données</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #000088;">$ctx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h2>Conclusion</h2>
<p>Les exemples présentés ne se limitent aux cas typique de récupération de pages distantes. Ces cas seront satisfaisant dans la plupart des cas. Si vous rencontrez un cas non décrit dans cet article vous trouverez peut être de l&#8217;aide <a href="http://www.php.documentation.givah.net/?p=wrappers.http.html" target="_blank">ici</a>. Et si vous avez toujours des problèmes vous pouvez me demander de l&#8217;aide dans les commentaires. <img src='http://pas-bien.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://pas-bien.net/blog/2007/12/21/utilisation-avancee-de-file_get_contents-php-5/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

