<?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>Thomas MALLEN &#187; Php</title>
	<atom:link href="http://www.thomas-mallen.fr/category/blog-actus/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.thomas-mallen.fr</link>
	<description>Web is just a poetry...</description>
	<lastBuildDate>Sat, 04 Feb 2012 09:46:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Afficher un flux RSS sur son site en PHP</title>
		<link>http://www.thomas-mallen.fr/blog-actus/afficher-un-flux-rss-sur-son-site-en-php.html</link>
		<comments>http://www.thomas-mallen.fr/blog-actus/afficher-un-flux-rss-sur-son-site-en-php.html#comments</comments>
		<pubDate>Sun, 02 Oct 2011 15:10:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog & Actus]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[fonction]]></category>
		<category><![CDATA[Rss]]></category>

		<guid isPermaLink="false">http://www.thomas-mallen.fr/?p=495</guid>
		<description><![CDATA[<p><img width="175" height="300" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/10/Rss_Flowers_by_CorouD1-175x300.png" class="attachment-medium wp-post-image" alt="Rss_Flowers_by_CorouD1" title="Rss_Flowers_by_CorouD1" /></p>Dans ce nouveau volet des fonctions assez utiles et que personnellement j&#8217;utilise assez souvent voici le lecteur de flux RSS d&#8217;actualité en PHP. Ainsi vous pourrez facilement donner encore un peu de dynamisme à votre site. Mais tout d&#8217;abord une petite explication sur les flux RSS. RSS kezako? Tout d&#8217;abord RSS signifie à l&#8217;origine &#171;&#160;Rich [...]]]></description>
			<content:encoded><![CDATA[<p><img width="175" height="300" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/10/Rss_Flowers_by_CorouD1-175x300.png" class="attachment-medium wp-post-image" alt="Rss_Flowers_by_CorouD1" title="Rss_Flowers_by_CorouD1" /></p><p>Dans ce nouveau volet des fonctions assez utiles et que personnellement j&#8217;utilise assez souvent voici le <strong>lecteur de flux RSS d&#8217;actualité en PHP</strong>. Ainsi vous pourrez facilement donner encore un peu de dynamisme à votre site.<br /><span id="more-495"></span><br />
Mais tout d&#8217;abord une petite explication sur les <strong>flux RSS</strong>.</p>
<h3>RSS kezako?</h3>
<p>Tout d&#8217;abord RSS signifie à l&#8217;origine &laquo;&nbsp;Rich Site Summary&nbsp;&raquo; ,littéralement &laquo;&nbsp;Sommaire de Site Enrichi&nbsp;&raquo; même si aujourd’hui on prefere les termes &laquo;&nbsp;Really Simple Syndication&nbsp;&raquo; (Syndication vraiment simple).</p>
<p>Pour faire simple un RSS est un flux de données qui contient généralement les dernières actualités, les derniers articles (ou autre) d&#8217;un site ou d&#8217;un soft. Ce flux est composé en xml, avec des balises plus ou moins standard contenant le plus souvent au minimum un titre, un teaser (ou un fragment de contenu), une date et lien pour accéder à l&#8217;article. Mis à jour fréquemment  il devient ainsi une source de contenu assez appréciable à faire remonter sur votre site.</p>
<p>Voyons comment faire ceci de manière simpliste grâce à <strong>PHP</strong>.</p>
<h3>fonction PHP pour un flux RSS</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p495code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4952"><td class="code" id="p495code2"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//_______________________________ lecteur de flux RSS</span>
<span style="color: #666666; font-style: italic;">//</span>
 <span style="color: #000000; font-weight: bold;">function</span> showRss<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nb_affichage</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/simplexml_load_file"><span style="color: #990000;">simplexml_load_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'SimpleXMLElement'</span><span style="color: #339933;">,</span> LIBXML_NOCDATA<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!@</span><span style="color: #000088;">$fluxrss</span><span style="color: #339933;">=</span><a href="http://www.php.net/simplexml_load_file"><span style="color: #990000;">simplexml_load_file</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> Flux introuvable<span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
         <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
         <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fluxrss</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">channel</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
&nbsp;
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li&gt;'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; target=&quot;_blank&quot;&gt;'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d/m/Y à G\hi'</span><span style="color: #339933;">,</span><a href="http://www.php.net/strtotime"><span style="color: #990000;">strtotime</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pubDate</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;strong&gt;'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <a href="http://www.php.net/utf8_decode"><span style="color: #990000;">utf8_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span><span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/strong&gt;'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
             <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
             <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #339933;">&gt;=</span><span style="color: #000088;">$nb_affichage</span><span style="color: #009900;">&#41;</span>  <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$return</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h3>Explication :</h3>
<ol>
<li><strong>simplexml_load_file : </strong>Pour aller chercher le flux à l&#8217;adresse passer dans la variable <em>$url</em>. L&#8217;adresse de votre RSS en somme</li>
<li><strong>if(!@$fluxrss=simplexml_load_file($url)){&#8230; : </strong>Juste pour retourner une erreur en cas d&#8217;échec de l&#8217;ouverture du flux</li>
<li><strong>foreach($fluxrss-&gt;channel-&gt;item as $item){&#8230; :</strong> boucler sur les items trouvé.</li>
<li>On met dans <em>$return</em> ce que l&#8217;on veut retourner dans sa liste d&#8217;actualité. Je vous laisse libre choix de votre composition. Vous pouvez rajouter la description par exemple ($item-&gt;description).</li>
</ol>
<p>Voilà sur ce que je peux vous en dire. Hésitez pas à laissez des commentaires si vous avez des questions.</p>
<h4>Enjoy!</h4>
]]></content:encoded>
			<wfw:commentRss>http://www.thomas-mallen.fr/blog-actus/afficher-un-flux-rss-sur-son-site-en-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wappalyzer: detecter le CMS, les framework, les outils, etc&#8230; des sites que vous visitez</title>
		<link>http://www.thomas-mallen.fr/blog-actus/php/wappalyzer-detecter-le-cms-les-framework-les-outils-etc-des-sites-que-vous-visitez.html</link>
		<comments>http://www.thomas-mallen.fr/blog-actus/php/wappalyzer-detecter-le-cms-les-framework-les-outils-etc-des-sites-que-vous-visitez.html#comments</comments>
		<pubDate>Sat, 01 Oct 2011 10:04:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Astuces Persos]]></category>
		<category><![CDATA[Javascripts]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.thomas-mallen.fr/?p=454</guid>
		<description><![CDATA[<p><img width="300" height="215" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/10/Capture-d’écran-2011-10-01-à-11.56.23-300x215.png" class="attachment-medium wp-post-image" alt="Wappalyzer" title="Wappalyzer" /></p>Wappalyzer est une extension (plugin) pour chrome et firefox, qui vous permettra de savoir instantanément quels frameworks JS/PHP, quel CMS, quel système analytique utilisé par le site que vous êtes en train de visiter. Très utile pour les développeurs de toutes sortes et/ou les amoureux des beaux sites, qui souhaitent savoir à quelle hormones marche le site qu'il visite.]]></description>
			<content:encoded><![CDATA[<p><img width="300" height="215" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/10/Capture-d’écran-2011-10-01-à-11.56.23-300x215.png" class="attachment-medium wp-post-image" alt="Wappalyzer" title="Wappalyzer" /></p><p>Aujourd&#8217;hui, focus sur un plugin pour google Chrome et Firefox :<strong> Wappalyzer</strong>.</p>
<p style="text-align: center;"><a href="http://www.thomas-mallen.fr/wp-content/uploads/2011/10/Capture-d’écran-2011-10-01-à-11.56.41.png"><img class="size-full wp-image-459 aligncenter" title="Capture d’écran 2011-10-01 à 11.56.41" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/10/Capture-d’écran-2011-10-01-à-11.56.41.png" alt="" width="419" height="109" /></a></p>
<p>Ce petit plugin téléchargeable dans les apsMarket des deux navigateurs et aussi sur le <a href="http://wappalyzer.com/install/" target="_blank">site officiel</a> vous permettra de connaitre instantanément les différents <strong>framework javascript/PHP</strong>, <strong>CMS</strong>, <strong>gestionnaire analytique (visite)</strong>, <strong>traquer d&#8217;erreur</strong>, et <strong>manager de base de données</strong> utilisés sur le site que vous êtes en train de visite.</p>
<p>Alors, les plus obstinés me diront &laquo;&nbsp;Ouais&#8230; mais euh&#8230; On peut savoir tout ça en regardant dans le code source&#8230;&nbsp;&raquo;. Oui bien sur, je le fesait moi aussi il y a peu&#8230; mais grâce à Wappalyzer inutile de chercher et de perdre son temps.</p>
<p><strong>Wappalyzer</strong> vous fournira ainsi ces infos à partir du bibliothèque de plus d&#8217;une centaine de framework, CMS etc&#8230; Autrement dit, il n&#8217;est pas exhaustif mais presque. Autre donnée importante: Wappalyzer regroupe sur son site les stats des différents cms, frameworks, gestionnaires analytiques grâce aux personnes ayant installées le plugin. Cela permet de confirmer que Jquery est en tête des frameworks, que WordPress est en pôle position des CMS etc&#8230;</p>
<p>Pour conclure, pour les developpeurs en herbe, ou pour les amoureux des beaux sites, qui souhaitent savoir à quoi marche un site, <strong>Wappalyzer</strong> est fait pour vous.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thomas-mallen.fr/blog-actus/php/wappalyzer-detecter-le-cms-les-framework-les-outils-etc-des-sites-que-vous-visitez.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Php : nettoyer une chaine de caractères pour une Url</title>
		<link>http://www.thomas-mallen.fr/blog-actus/php/php-nettoyer-une-chaine-de-caracteres-pour-une-url.html</link>
		<comments>http://www.thomas-mallen.fr/blog-actus/php/php-nettoyer-une-chaine-de-caracteres-pour-une-url.html#comments</comments>
		<pubDate>Tue, 15 Feb 2011 10:16:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[fonction]]></category>
		<category><![CDATA[Url]]></category>

		<guid isPermaLink="false">http://www.thomas-mallen.fr/?p=224</guid>
		<description><![CDATA[<p><img width="300" height="300" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/washable-keyboard12.jpeg" class="attachment-medium wp-post-image" alt="washable-keyboard12" title="washable-keyboard12" /></p>Une autre petite fonction php toute easy. Cette fois ci je vous propose de nettoyer vos chaînes de caractères afin de les utiliser dans vos urls. Coté référencement naturel et accessibilité web il est en effet de rigueur d’avoir des urls les plus propres possibles. Pour ceci la méthode est simple: pas de caractères spéciaux, des tirets en [...]]]></description>
			<content:encoded><![CDATA[<p><img width="300" height="300" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/washable-keyboard12.jpeg" class="attachment-medium wp-post-image" alt="washable-keyboard12" title="washable-keyboard12" /></p><p>Une autre petite <strong>fonction php</strong> toute easy. Cette fois ci je vous propose de <strong>nettoyer vos chaînes de caractères afin de les utiliser dans vos urls</strong>.<br />
Coté référencement naturel et accessibilité web il est en effet de rigueur d’avoir des <strong>urls les plus propres </strong>possibles.<br />
Pour ceci la méthode est simple: pas de caractères spéciaux, des tirets en guise d’espace, et dans le meilleur des cas, enlever les articles (il, la, les…)</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p224code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2244"><td class="code" id="p224code4"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//_______________________________ nettoyage pour url propre</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000000; font-weight: bold;">function</span> cleanChaine<span style="color: #009900;">&#40;</span><span style="color: #000088;">$String</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$Search</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>n&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>r&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;     &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;    &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&amp;amp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;        &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;       &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;      &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;     &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;    &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;   &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;  &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;à&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;á&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;â&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;à&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;À&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ç&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ç&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Ç&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;é&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;è&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ê&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ë&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;É&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;È&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;é&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;è&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ê&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;í&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ï&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ï&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;î&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ñ&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ô&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ò&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ö&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ô&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ó&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Ó&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ù&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;û&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$Replace</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;a&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;A&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;c&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;c&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;C&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;E&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;E&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;n&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;o&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;O&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;u&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;u&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;\;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$String</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$Search</span><span style="color: #339933;">,</span> <span style="color: #000088;">$Replace</span><span style="color: #339933;">,</span> <span style="color: #000088;">$String</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$String</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$String</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$String</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$String</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">return</span> <span style="color: #000088;">$String</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$chaine</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Ma chaine à nettoyer'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$chainePropre</span> <span style="color: #339933;">=</span>  cleanChaine<span style="color: #009900;">&#40;</span><span style="color: #000088;">$chaine</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;a href=&quot;/articles/'</span><span style="color: #339933;">.</span><span style="color: #000088;">$chainePropre</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.php&quot;&gt;Mon lien&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h3>Comment ca marche:</h3>
<ol>
<li><strong>str_replace</strong> : Avec un array -&gt;<em><strong> </strong></em>On peu définir dans 2 array les valeurs à remplacer et les valeurs à mettre à la place. Il est important que les places dans les array correspondent. Ainsi dans mon exemple <em><strong>à</strong></em> sera remplacé par le <em><strong>a</strong></em></li>
<li><strong>str_replace</strong> : Sans array (Sans arrêt! mouhahaha <img src='http://www.thomas-mallen.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). Vous pouvez directement déclarer dans le str_replace la chaine à trouver et à remplacer. Ici les apostrophes seront remplacées par des tirets.</li>
</ol>
<p>Avec ça, vous n’avez plus d’excuse pour ne pas avoir de magnifiques urls.</p>
<h4>Have fun!</h4>
]]></content:encoded>
			<wfw:commentRss>http://www.thomas-mallen.fr/blog-actus/php/php-nettoyer-une-chaine-de-caracteres-pour-une-url.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: script for drunks</title>
		<link>http://www.thomas-mallen.fr/blog-actus/php/php-script-for-drunks.html</link>
		<comments>http://www.thomas-mallen.fr/blog-actus/php/php-script-for-drunks.html#comments</comments>
		<pubDate>Mon, 14 Feb 2011 15:23:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Astuces Persos]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.thomas-mallen.fr/?p=214</guid>
		<description><![CDATA[<p><img width="251" height="300" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/coding_drunk-251x300.jpg" class="attachment-medium wp-post-image" alt="coding_drunk" title="coding_drunk" /></p>Un petit code Php bien sympa pour resumer une soirée bien arrosée... Tellement vrai et si bon!
Merci à Olliebollie.]]></description>
			<content:encoded><![CDATA[<p><img width="251" height="300" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/coding_drunk-251x300.jpg" class="attachment-medium wp-post-image" alt="coding_drunk" title="coding_drunk" /></p><p>Un petit code Php bien sympa pour resumer une soirée bien arrosée&#8230; Tellement vrai et si bon!<br />
Merci à <a rel="nofollow" href="http://olliebollie.deviantart.com/" target="_blank">Olliebollie</a>.<span id="more-214"></span></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p214code5'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2145"><td class="code" id="p214code5"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$party</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$wallet</span><span style="color: #009900;">&#41;</span> and <a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'walk'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$bouncer</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thomas-mallen.fr/blog-actus/php/php-script-for-drunks.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fonction Php: couper une chaine sans couper les mots</title>
		<link>http://www.thomas-mallen.fr/blog-actus/php/fonction-php-pour-couper-une-chaine-de-caractere-sans-couper-les-mots.html</link>
		<comments>http://www.thomas-mallen.fr/blog-actus/php/fonction-php-pour-couper-une-chaine-de-caractere-sans-couper-les-mots.html#comments</comments>
		<pubDate>Mon, 14 Feb 2011 15:10:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.thomas-mallen.fr/?p=204</guid>
		<description><![CDATA[<p><img width="300" height="232" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/url-Trois-services-de-raccourci-d’URL-vraiment-courts-300x232.jpg" class="attachment-medium wp-post-image" alt="url Trois services de raccourci d’URL vraiment courts" title="url Trois services de raccourci d’URL vraiment courts" /></p>Petit fonction toute facile pour couper une chaine de caractère sans couper les mots et sans briser des balises. Le fonctionnement est ultra simpliste et modifiable à votre convenance. Voici la petite fonction: ?View Code PHP//_______________________________ couper une chaine sans couper les mots // function coupeChaine&#40;$text, $max&#41; &#123; if &#40;strlen&#40;$text&#41; &#62;= $max&#41; &#123; $text = [...]]]></description>
			<content:encoded><![CDATA[<p><img width="300" height="232" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/url-Trois-services-de-raccourci-d’URL-vraiment-courts-300x232.jpg" class="attachment-medium wp-post-image" alt="url Trois services de raccourci d’URL vraiment courts" title="url Trois services de raccourci d’URL vraiment courts" /></p><p>Petit fonction toute facile pour couper une chaine de caractère sans couper les mots et sans briser des balises. Le fonctionnement est ultra simpliste et modifiable à votre convenance.</p>
<h3>Voici la petite fonction:</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p204code7'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2047"><td class="code" id="p204code7"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//_______________________________ couper une chaine sans couper les mots</span>
<span style="color: #666666; font-style: italic;">//</span>
  <span style="color: #000000; font-weight: bold;">function</span> coupeChaine<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ereg_replace"><span style="color: #990000;">ereg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;[^&gt;]*&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$positionEspace</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strrpos"><span style="color: #990000;">strrpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$positionEspace</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;...&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$text</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$chaine</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'Ma chaine à couper... Oulà elle est très longue... En plus je met des balises &lt;strong&gt;ici&lt;/strong&gt; et &lt;em&gt;là&lt;/em&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$chaineCoupee</span> <span style="color: #339933;">=</span>  coupeChaine<span style="color: #009900;">&#40;</span><span style="color: #000088;">$chaine</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$chaineCoupee</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h3>Comment ca marche:</h3>
<ol>
<li><strong>strlen</strong> : compte le nombre de caractère dans la chaine originale, puis rentre dans le <strong>‘if’</strong> si ce nombre est supérieure au nombre <em><strong>$max</strong></em>.</li>
<li><strong>ereg_replace</strong> : On enlève toutes les balises html (pour éviter de tronquer la chaine en plein milieu d’une de ces balises).</li>
<li><strong>substr</strong> : coupe la chaîne au caractère placé en <em><strong>$max</strong></em> position.</li>
<li><strong>strrpos</strong> : trouve la position du dernier espace dans la chaîne restante. La position est ensuite mis dans la variable <em><strong>$positionEspace</strong></em>.</li>
<li><strong>substr + position à couper</strong> : coupe la chaîne à la position <em><strong>$positionEspace</strong></em>. On y rajoute ensuite les “…”</li>
<li><strong>appel de la fonction</strong> : le premier paramètre de la fonction est donc le texte à tronquer, le second est le nombre de caractère max à garder dans la chaîne finale.</li>
</ol>
<p>Voilà donc pour cette petite fonction toute simple mais bien utile.</p>
<h4>Have fun!</h4>
]]></content:encoded>
			<wfw:commentRss>http://www.thomas-mallen.fr/blog-actus/php/fonction-php-pour-couper-une-chaine-de-caractere-sans-couper-les-mots.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Obtenir le code source d’une page distante</title>
		<link>http://www.thomas-mallen.fr/blog-actus/php/obtenir-le-code-source-dune-page-distante.html</link>
		<comments>http://www.thomas-mallen.fr/blog-actus/php/obtenir-le-code-source-dune-page-distante.html#comments</comments>
		<pubDate>Thu, 10 Feb 2011 22:18:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://www.thomas-mallen.fr/?p=180</guid>
		<description><![CDATA[<p><img width="300" height="240" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/php__by_2xa-300x240.jpg" class="attachment-medium wp-post-image" alt="php__by_2xa" title="php__by_2xa" /></p>Voilà une petite fonction toute simple afin de mettre en variable le code source d’une page d’un autre site. Attention, votre serveur doit permettre l’appel de page externe. Pour voir si c’est bien le cas, vous pouvez vérifier si le paramètre “allow_url_fopen” est bien sur “On” grace à un petit phpinfo(). Si votre écran vous affiche [...]]]></description>
			<content:encoded><![CDATA[<p><img width="300" height="240" src="http://www.thomas-mallen.fr/wp-content/uploads/2011/02/php__by_2xa-300x240.jpg" class="attachment-medium wp-post-image" alt="php__by_2xa" title="php__by_2xa" /></p><p>Voilà une petite fonction toute simple afin de mettre en variable le <strong>code source d’une page d’un autre site</strong>. Attention, votre serveur doit permettre l’appel de page externe. Pour voir si c’est bien le cas, vous pouvez vérifier si le paramètre “<strong>allow_url_fopen” </strong>est bien sur “<strong>On” </strong>grace à un petit phpinfo().</p>
<p>Si votre écran vous affiche un malheureux “<em>Warning: fopen()</em>” c’est que justement votre serveur n’autorise pas la <strong>lecture d’un fichier distant de votre site</strong>. Si vous êtes sur un serveur dédié ou en local: pas de panique vous pouvez corriger ca dans les parametres de celui-ci (php.ini). Par contre si vous êtes sur un serveur mutualisé, là, peu de recours: seulement un mail où une demande à votre hébergeur pour l’implorer de vous donner ce droit.</p>
<h3>Voici le petit code en question:</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p180code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1809"><td class="code" id="p180code9"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//_______________________________ lecture +mise en variable d'une page distante</span>
<span style="color: #666666; font-style: italic;">//</span>
<span style="color: #000000; font-weight: bold;">function</span> lectureCodeSource<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: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span> <span style="color: #339933;">=</span><a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;rb&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/stream_get_contents"><span style="color: #990000;">stream_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
               <span style="color: #000088;">$contents</span><span style="color: #339933;">=</span><a href="http://www.php.net/htmlentities"><span style="color: #990000;">htmlentities</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contents</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #b1b100;">return</span> <span style="color: #000088;">$contents</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'La page n\'a pas pu etre scannée '</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'La page n\'a pas pu etre scannée '</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span>
    <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$codeSource</span> <span style="color: #339933;">=</span>  lectureCodeSource<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.thomas-mallen.fr/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$codeSource</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//</span></pre></td></tr></table></div>

<h3>Le principe:</h3>
<ol>
<li><strong>fopen</strong> : Ouverture de la page avec les bons droits (rb).</li>
<li><strong>stream_get_contents</strong> :  obtention du flux de contenu.</li>
<li><strong>htmlentities</strong> : conversion des balises en texte standard.</li>
<li><strong>fclose</strong> : fermeture de la page.</li>
<li><strong>echo</strong> : affichage du retour de la fonction.</li>
</ol>
<p>Cette fonction est très utile pour faire des opérations sur des sources de site. En effet, vous pouvez par exemple faire passer ce code source dans une fonction d’étude de mots clés, ou de repérage des balises méta…</p>
<h4>Enjoy It</h4>
]]></content:encoded>
			<wfw:commentRss>http://www.thomas-mallen.fr/blog-actus/php/obtenir-le-code-source-dune-page-distante.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

