<?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>Anthor.Net &#187; PHP</title>
	<atom:link href="http://www.anthor.net/blog/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anthor.net</link>
	<description></description>
	<lastBuildDate>Mon, 05 Dec 2011 16:29:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Démarrage rapide avec Webgame Achievements</title>
		<link>http://www.anthor.net/blog/developpement/demarrage-rapide-avec-webgame-achievements/</link>
		<comments>http://www.anthor.net/blog/developpement/demarrage-rapide-avec-webgame-achievements/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 17:23:35 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Jeu par Navigateur]]></category>
		<category><![CDATA[Achievements]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=768</guid>
		<description><![CDATA[Un service destiné à être utilisé par des néophytes se doit d&#8217;avoir une bonne documentation, actuellement, ceci manque sur Achievements, principalement par manque de temps, et aussi car j&#8217;aime avoir un contact proche avec les participants. Néanmoins, je livre ici une première version du &#171;&#160;Quick Start&#160;&#187;, et d&#8217;autres suivront. La publication va permettre de motiver [...]]]></description>
			<content:encoded><![CDATA[<p>Un service destiné à être utilisé par des néophytes se doit d&#8217;avoir une bonne documentation, actuellement, ceci manque sur <a href="http://www.webgame-achievements.com/">Achievements</a>, principalement par manque de temps, et aussi car j&#8217;aime avoir un contact proche avec les participants.</p>
<p>Néanmoins, je livre ici une première version du &laquo;&nbsp;Quick Start&nbsp;&raquo;, et d&#8217;autres suivront. La publication va permettre de motiver plus de jeux à participer, notamment en expliquant de façon un peu plus détaillé le fonctionnement de l&#8217;API. Ce tuto est disponible pour les éditeurs, de façon privé, dans leur interface.</p>
<p><span id="more-768"></span></p>
<p>
        <strong>Achievements</strong> se compose d&#8217;une classe PHP ainsi que d&#8217;une feuille de style, permettant la communication avec le service et l&#8217;affichage au sein du jeu.
    </p>
<p>
        Le service requiert d&#8217;installer sur le serveur l&#8217;extension <strong>CURL</strong> (Pour communiquer avec le serveur) et l&#8217;extension <strong>MCRYPT</strong> (Pour crypter les communications entre votre jeu et le serveur).
    </p>
<p>
        Imaginons une page standard comportant un formulaire, ce formulaire servira à introduire les mécanismes de communication vers le service, en simulant l&#8217;activité du joueur, tel qu&#8217;une attaque ou une création d&#8217;objets.
    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Ici votre code habituel pour gérer l'action du joueur</span>
    <span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC 
    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Démarrez rapidement avec Achievements&lt;/title&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
        &lt;input type=&quot;text&quot; name=&quot;playerAction&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nbObject</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Action du joueur&quot; /&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>
        La page d&#8217;exemple est volontairement simplifiée afin de se concentrer sur la mise en place du service.
    </p>
<h4>Inclure la classe Achievements</h4>
<p>
        Récupérer le code PHP de la classe Achievements (Disponible dans la rubrique <a>Éditeur &raquo; Fichier API</a>) afin de l&#8217;injecter dans un fichier &laquo;&nbsp;Achievements.php&nbsp;&raquo;.<br />
        Si vous utilisez la version commune, il faut penser à modifier les clés privées et publiques, pour correspondre à celle de votre jeu.
    </p>
<p>
        Une fois le fichier créé, il suffit de l&#8217;inclure dans votre projet. De cette manière, la classe est accessible pour être utilisée.
    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Achievements.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Ici votre code habituel pour gérer l'action du joueur</span>
    <span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC 
    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Démarrez rapidement avec Achievements&lt;/title&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
        &lt;input type=&quot;text&quot; name=&quot;playerAction&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nbObject</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Action du joueur&quot; /&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>
        Il est recommandé de placer cette ligne le plus tôt possible dans votre projet et avant toute sortie HTML.
    </p>
<h4>Inclure le style CSS</h4>
<p>
        Vous pouvez définir différentes couleurs afin d&#8217;harmoniser le service avec votre jeu dans la rubrique <a>Éditeur &raquo; Éditeur de style CSS</a>.
    </p>
<p>
        Une fois vos couleurs définies, copier/coller le code source obtenu à la fin de votre fichier CSS actuel, ou bien en créer un nouveau et intégrez-le dans le header de votre jeu.
    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Achievements.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Ici votre code habituel pour gérer l'action du joueur</span>
    <span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC 
    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Démarrez rapidement avec Achievements&lt;/title&gt;
&nbsp;
    &lt;link href=&quot;/css/achievements.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
        &lt;input type=&quot;text&quot; name=&quot;playerAction&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nbObject</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Action du joueur&quot; /&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>
        Il est recommandé d&#8217;utiliser votre fichier CSS existant afin de limiter le nombre de requêtes sur votre serveur.
    </p>
<h4>Instancier un joueur spécifique</h4>
<p>
        Un joueur est reconnu sur <strong>Achievements</strong> grâce au hash de son email.<br />
        L&#8217;architecture de la classe permet de travailler sur plusieurs joueurs à la fois, ainsi, vous pouvez tout à fait accorder un succès à un joueur qui a paré l&#8217;attaque du joueur courant.
    </p>
<p>
        Dans notre exemple, nous instancions uniquement le joueur courant, afin d&#8217;envoyer des informations le concernant.<br />
        Dans tous les cas le hash de l&#8217;email est unique, assurant que le joueur retrouvera ces informations qu&#8217;il soit inscrit ou non sur <strong>Achievements</strong> au moment de l&#8217;action.
    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Achievements.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$myPlayerAchievements</span> <span style="color: #339933;">=</span> Achievements<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'emailDuJoueur@domaine.com'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Ici votre code habituel pour gérer l'action du joueur</span>
    <span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC 
    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Démarrez rapidement avec Achievements&lt;/title&gt;
&nbsp;
    &lt;link href=&quot;/css/achievements.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
        &lt;input type=&quot;text&quot; name=&quot;playerAction&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nbObject</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Action du joueur&quot; /&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<h4>Afficher les succès au joueur</h4>
<p>
        Une fois que vous avez accès à l&#8217;instance du joueur courant, il faut pouvoir lui afficher le résultat de ses succès.<br />
        Une méthode dédiée s&#8217;occupe de cela en fournissant un code xHTML, ainsi que le javascript associé.
    </p>
<p>
        En la plaçant avant la fermeture de la balise <body>, vous vous assurez que les messages destinés au joueur courant lui parvienne uniquement lorsqu&#8217;il affiche une page complète.<br />
        En effet en cas de redirection, la méthode n&#8217;est pas appelée et les messages restent dans le cache jusqu&#8217;à ce que le joueur affiche une page.
    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Achievements.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$myPlayerAchievements</span> <span style="color: #339933;">=</span> Achievements<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'emailDuJoueur@domaine.com'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Ici votre code habituel pour gérer l'action du joueur</span>
    <span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC 
    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Démarrez rapidement avec Achievements&lt;/title&gt;
&nbsp;
    &lt;link href=&quot;/css/achievements.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
        &lt;input type=&quot;text&quot; name=&quot;playerAction&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nbObject</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Action du joueur&quot; /&gt;
    &lt;/form&gt;
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$myPlayerAchievements</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">printStatus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<h4>Communiquer avec Achievements</h4>
<p>
        Une fois la mise en place effectuée, il ne reste plus qu&#8217;à communiquer avec <strong>Achievements</strong> lorsqu&#8217;un joueur effectue une action.
    </p>
<p>
        Pour cela il faut créer un succès dans l&#8217;interface du service, et récupérer le code donné. La clé du succès est automatiquement remplacée par la clé du succès courant.<br />
        Le service recevra la valeur donnée et renverra une réponse contenant les informations nécessaires à l&#8217;affichage.<br />
        Ces informations sont traitées de façon automatisées par la classe, et vous n&#8217;avez donc pas à vous en préoccuper.
    </p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/Achievements.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$myPlayerAchievements</span> <span style="color: #339933;">=</span> Achievements<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'emailDuJoueur@domaine.com'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Ici votre code habituel pour gérer l'action du joueur</span>
    <span style="color: #000088;">$nbObject</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'playerAction'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Le code envoyant la valeur courante à Achievements</span>
    try
    <span style="color: #009900;">&#123;</span>   
        <span style="color: #000088;">$myPlayerAchievements</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updateAchievement</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'XXXXXXXX'</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// Clé du succès</span>
            <span style="color: #000088;">$nbObject</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    catch<span style="color: #009900;">&#40;</span> Exception <span style="color: #000088;">$e</span> <span style="color: #009900;">&#41;</span> 
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// Mettre ici votre gestion d'erreurs.</span>
        <span style="color: #666666; font-style: italic;">// Ou laisser vide pour ne pas bloquer le jeu en cas de panne du service.</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html PUBLIC 
    &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; 
    &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Démarrez rapidement avec Achievements&lt;/title&gt;
&nbsp;
    &lt;link href=&quot;/css/achievements.css&quot; media=&quot;screen&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
    &lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
        &lt;input type=&quot;text&quot; name=&quot;playerAction&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nbObject</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Action du joueur&quot; /&gt;
    &lt;/form&gt;
&nbsp;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$myPlayerAchievements</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">printStatus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/demarrage-rapide-avec-webgame-achievements/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Webgame Achievements</title>
		<link>http://www.anthor.net/blog/developpement/webgame-achievements/</link>
		<comments>http://www.anthor.net/blog/developpement/webgame-achievements/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 13:44:00 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Jeu par Navigateur]]></category>
		<category><![CDATA[Achievements]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=741</guid>
		<description><![CDATA[J&#8217;en avais vaguement parlé dans un précédent billet, et c&#8217;est aujourd&#8217;hui chose faite ! &#171;&#160;Achievements&#160;&#187; est en ligne dans une première version et n&#8217;attend plus que des jeux se joignent à l&#8217;aventure pour prendre son envol. Comme l&#8217;explique SorenS, Achievements permettra aux jeux par navigateur de fidéliser un peu plus leurs joueurs avec un service [...]]]></description>
			<content:encoded><![CDATA[<p>J&#8217;en avais vaguement parlé dans un <a href="http://www.anthor.net/blog/developpement/trophees-et-succes-dans-les-jeux-par-navigateur/">précédent billet</a>, et c&#8217;est aujourd&#8217;hui chose faite !</p>
<p>&laquo;&nbsp;<a href="http://www.webgame-achievements.com/">Achievements</a>&nbsp;&raquo; est en ligne dans une première version et n&#8217;attend plus que des jeux se joignent à l&#8217;aventure pour prendre son envol.</p>
<p>Comme l&#8217;explique <a href="http://rkueny.fr/jeu-web/fideliser-ses-joueurs-sur-son-jeu-facebook">SorenS</a>, Achievements permettra aux jeux par navigateur de fidéliser un peu plus leurs joueurs avec un service simple à mettre en place.<span id="more-741"></span></p>
<p>Une classe PHP permet de communiquer avec l&#8217;API et gère l&#8217;affichage du résultat pour les joueurs. Le résultat est visible sur les <a href="http://www.webgame-achievements.com/fr/demonstration">démonstrations</a>, qui utilisent la même API que les jeux. Ces démonstrations sont avant tout destinées aux futurs éditeurs du service afin de comprendre les différents types de succès qu&#8217;il est possible de mettre en place.<br />
Grâce à un système de cache évolué aussi bien côté serveur que côté client, le service est rapide et ne fait pas plus de requêtes que nécessaire.</p>
<p>Par exemple, si un joueur a déverrouillé un succès, alors aucune requête ne sera faite à l&#8217;API. De la même manière des vérifications permettent lors de l&#8217;édition d&#8217;un succès de débloquer le cache afin de refaire des requêtes vers l&#8217;API lorsque le joueur effectuera des actions sur le jeu. Tout cela étant évidemment transparent, car il n&#8217;y a que 3 méthodes pouvant être appelées.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Un singleton pour utiliser un joueur en particulier</span>
<span style="color: #000088;">$myAchievement</span> <span style="color: #339933;">=</span> Achievements<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'emaildujoueur@mondomaine.com'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Une fonction lorsqu'un joueur se connecte au jeu</span>
<span style="color: #000088;">$myAchievement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">playerPlays</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'login'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Une fonction pour mettre à jour un succès</span>
try
<span style="color: #009900;">&#123;</span>  
    <span style="color: #000088;">$myAchievement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">updateAchievement</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'clé du succès'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'valeur'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
catch<span style="color: #009900;">&#40;</span> Exception <span style="color: #000088;">$e</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Exception: '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Une fonction à n'utiliser qu'en fin de fichier avant la fermeture de &lt;body&gt; </span>
<span style="color: #666666; font-style: italic;">// pour gérer l'affichage du joueur concerné par l'instance.</span>
<span style="color: #000088;">$myAchievement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">printStatus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Le service est fourni avec un back-office complet qui permet aux éditeurs d&#8217;être globalement autonome dans la gestion de leurs jeux et de leurs succès. Il est gratuit, et le seul retour se situe lors de l&#8217;affichage des succès pour le joueur, afin de le rediriger sur son profil. Concernant les emails, ils ne sont pas envoyés au service. Tout fonctionne grâce à une clé unique générée pour chaque email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/webgame-achievements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Trophées et Succès dans les jeux par navigateur</title>
		<link>http://www.anthor.net/blog/developpement/trophees-et-succes-dans-les-jeux-par-navigateur/</link>
		<comments>http://www.anthor.net/blog/developpement/trophees-et-succes-dans-les-jeux-par-navigateur/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 21:40:25 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[Jeu par Navigateur]]></category>
		<category><![CDATA[Achievements]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=715</guid>
		<description><![CDATA[Qu&#8217;ils soient appelés Trophées sur PS3, Succès sur xBox ou Steam, ou différemment sur d&#8217;autres plateformes, la fonctionnalité reste la même. Rassembler les joueurs vers un but secondaire afin d&#8217;ajouter un challenge aux jeux. Psychologiquement, ça à l&#8217;air de fonctionner, l&#8217;effet sur les joueurs est immédiat en donnant l&#8217;envie d&#8217;atteindre un but pouvant être comparé [...]]]></description>
			<content:encoded><![CDATA[<p>Qu&#8217;ils soient appelés Trophées sur PS3, Succès sur xBox ou Steam, ou différemment sur d&#8217;autres plateformes, la fonctionnalité reste la même.<br />
Rassembler les joueurs vers un but secondaire afin d&#8217;ajouter un challenge aux jeux.<br />
<span id="more-715"></span><br />
Psychologiquement, ça à l&#8217;air de fonctionner, l&#8217;effet sur les joueurs est immédiat en donnant l&#8217;envie d&#8217;atteindre un but pouvant être comparé avec d&#8217;autres joueurs, voir ses amis.</p>
<p>Techniquement, ce n&#8217;est pas compliqué à implémenter, mais alors pourquoi les jeux web n&#8217;en proposent pas plus ?<br />
Tout simplement je pense car le domaine est trop fragmenté. Un jeu seul ou un éditeur seul aura moins de poids qu&#8217;une plateforme qui mélange un grand nombre de jeux différents.</p>
<p>Il existe <a href="http://muxxu.com/">Muxxu</a>, mais celui-ci reste limité à quelques-uns des jeux <a href="http://www.motion-twin.com/">Motion-Twin</a>. Si le portail est intéressant, il reste limité car non ouvert.</p>
<p>Dès le début du développement de Tarschool, j&#8217;avais en tête de le relier à un portail permettant de partager à la fois les comptes, mais aussi des succès. De plus, les joueurs me l&#8217;ont suggéré.</p>
<p>Je suis donc parti sur une API permettant de communiquer avec un portail. Un joueur est identifié grâce au hash de son email.<br />
Lorsqu&#8217;il effectue une action sur le jeu, l&#8217;API est contactée et renvoie soit une erreur, soit la réussite de l&#8217;envoi, et gère elle-même l&#8217;affichage pour les joueurs si un succès est débloqué.</p>
<p>On distinguera trois types de succès : Atteindre une certaine valeur, Atteindre une valeur unique, Effectuer une action unique. Le dernier correspondant à une valeur unique de 1 ^^ Ces succès pouvant aussi avoir un prérequis avant de pouvoir être débutés/validés.</p>
<p>Toutes les communications se feront en cryptées à l&#8217;aide d&#8217;une clé publique et d&#8217;une clé privé. En l&#8217;état actuel, la classe servant pour le jeu est bien avancé, le plus compliqué a été de rendre compatible le cryptage avec le plus de configuration possible.</p>
<p>Plus d&#8217;infos bientôt, si certains sont intéressés pour des tests, n&#8217;hésitez pas à me contacter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/trophees-et-succes-dans-les-jeux-par-navigateur/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Utiliser Zend_Search_Lucene pour créer son propre moteur de recherche !</title>
		<link>http://www.anthor.net/blog/developpement/utiliser-zend_search_lucene-pour-creer-son-propre-moteur-de-recherche/</link>
		<comments>http://www.anthor.net/blog/developpement/utiliser-zend_search_lucene-pour-creer-son-propre-moteur-de-recherche/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 11:00:40 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=533</guid>
		<description><![CDATA[Le Zend Framework contient un composant permettant de créer rapidement et simplement son propre moteur de recherche ! Ce composant nommé Zend_Search_Lucene est un portage, du projet Java du même nom, totalement écrit en PHP5. Ce composant est autonome et ne demande aucune architecture spécifique. De ce fait il peux servir pour tout nouveau projet [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.anthor.net/wp-content/uploads/2010/01/zf_logo_white.jpg" alt="" title="" width="130" height="58" class="alignleft size-full wp-image-536" /><br />
Le Zend Framework contient un composant permettant de créer rapidement et simplement son propre moteur de recherche ! Ce composant nommé <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a> est un portage, du <a href="http://lucene.apache.org/java/docs/">projet Java</a> du même nom, totalement écrit en PHP5.<br />
<span id="more-533"></span><br />
Ce composant est autonome et ne demande aucune architecture spécifique. De ce fait il peux servir pour tout nouveau projet ou s&#8217;intégrer dans un projet existant. Aucune base de données n&#8217;est nécessaire. De plus les index peuvent être utilisés aussi bien avec <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a>, qu&#8217;avec tout autre portage de Lucene (Attention toutefois, tous les encodages ne sont pas supportés !)<br />
Il supporte différents encodages grâce à l&#8217;utilisation de différents analyseurs, mais pas l&#8217;UTF-8 par défaut, comme PHP me direz-vous :p</p>
<p>Contrairement au reste de la documentation et des autres composants du Zend Framework, le fonctionnement de <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a> n&#8217;est pas des plus explicites.<br />
Dans cet article nous verrons donc, comment utiliser <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a> pour construire un index, construire les requêtes de recherches et enfin afficher les résultats dans une page. Le tout en  UTF-8 bien évidemment.</p>
<h4>Configuration du module</h4>
<p>Tout d&#8217;abord, commençons par modifier le comportement par défaut du composant, en lui passant un analyseur compatible avec l&#8217;UTF8, les caractères numériques mais aussi insensible à la casse.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Zend_Search_Lucene_Analysis_Analyzer<span style="color: #339933;">::</span><span style="color: #004000;">setDefault</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num_CaseInsensitive<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>L&#8217;index de recherche</h4>
<p>Avant de pouvoir effectuer la moindre recherche, il faut d&#8217;abord construire l&#8217;index qui nous servira de base pour la recherche.<br />
La construction de l&#8217;index permet d&#8217;importer des documents, eux-mêmes composés de champs. Ce sont les champs qui permettent à <a href="http://framework.zend.com/manual/en/zend.search.lucene.html">Zend_Search_Lucene</a> de retrouver quel document doit ressortir dans les résultats de recherche.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$index</span> <span style="color: #339933;">=</span> Zend_Search_Lucene<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/data/lucene'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Une fois l&#8217;index créé, nous devons inclure des documents à celui-ci, il ne faut pas oublier de forcer l&#8217;encodage des champs en UTF-8, afin qu&#8217;il soit concordant avec l&#8217;encodage de l&#8217;analyseur.<br />
Chaque champs du document représente différents type, permettant ainsi de découper les résultats sous plusieurs formes en s&#8217;adaptant à la structure de l&#8217;application. On y stocke par exemple l&#8217;URL de la page à voir, son titre, son auteur&#8230; </p>
<p>Les différents types de champs possibles sont :</p>
<ul>
<li><strong>Keyword :</strong> Les données sont indexées et stockées, mais pas tokenisées. Par exemple pour l&#8217;identifiant, l&#8217;url&#8230;</li>
<li><strong>UnIndexed :</strong> Les données sont stockées mais pas indexées. Par exemple pour l&#8217;aperçu du contenu, la date de création&#8230;</li>
<li><strong>UnStored :</strong> Les données ne sont pas stockées, mais indexées et tokenisées. Par exemple pour le contenu du document&#8230;</li>
<li><strong>Text :</strong> Les données sont indexées, stockées et tokenisées. Par exemple pour le titre, l&#8217;auteur&#8230;</li>
<li><strong>Binary :</strong> Les données ne sont pas indexées, ni tokenisées, mais sont stockées en binaire. Par exemple pour l&#8217;image&#8230;</li>
</ul>
<p>Les données stockées peuvent être affichées dans les résultats de recherche. Les données indexées permettent de trier les résultats de recherche par ordre d&#8217;importance. Les données tokenisées permettent de découper le contenu en mots clés pour la recherche.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$document</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Search_Lucene_Document<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span> Zend_Search_Lucene_Field<span style="color: #339933;">::</span><span style="color: #004000;">keyword</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'idPost'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">52</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span> Zend_Search_Lucene_Field<span style="color: #339933;">::</span><span style="color: #004000;">unIndexed</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'preview'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contenu contenu2...'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span> Zend_Search_Lucene_Field<span style="color: #339933;">::</span><span style="color: #004000;">unStored</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'contenu contenu2 contenu3 contenu4'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$document</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addField</span><span style="color: #009900;">&#40;</span> Zend_Search_Lucene_Field<span style="color: #339933;">::</span><span style="color: #004000;">text</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Titre de mon résultat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$index</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addDocument</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$document</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Jusqu&#8217;ici nous avons ajouté des documents, mais aucune modification n&#8217;est apporté à l&#8217;index tant que la méthode commit() n&#8217;est pas appelée. Il est donc tout à fait possible de boucler des éléments d&#8217;une table pour les convertir en document pour l&#8217;index. En cas de mises à jour successives, la méthode optimize() permet d&#8217;optimiser l&#8217;index.</p>
<p>Il existe bien évidemment d&#8217;autres types de documents permettant d&#8217;importer directement des fichiers Word 2007, Powerpoint 2007 ou encore Excel 2007 dans l&#8217;index.<br />
Attention, on ne peux utiliser de champs nommé &laquo;&nbsp;id&nbsp;&raquo;, celui-ci correspond à l&#8217;id du document dans l&#8217;index.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$index</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">commit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$index</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">optimize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Et voilà, l&#8217;index de recherche est créé, et contient des documents. Il est maintenant possible d&#8217;effectuer des requêtes sur cet index et d&#8217;en retourner les résultats.</p>
<h4>Requêtes et affichage des résultats</h4>
<p>Afin d&#8217;interroger l&#8217;index, il suffit de l&#8217;ouvrir avec la méthode appropriée. Une fois l&#8217;index ouvert, il suffit simplement de passer une variable contenant la recherche dans la méthode find() qui retourne les résultats.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$index</span> <span style="color: #339933;">=</span> Zend_Search_Lucene<span style="color: #339933;">::</span><span style="color: #004000;">open</span><span style="color: #009900;">&#40;</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/data/lucene'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$index</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$q</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// $q = 'test recherche';</span>
&nbsp;
<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> Zend_Paginator<span style="color: #339933;">::</span><span style="color: #004000;">factory</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPageRange</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">10</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setCurrentPageNumber</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_getParam<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setItemCountPerPage</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">20</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$page</span><span style="color: #339933;">;</span></pre></div></div>

<p>Comme on peux le constater, le composant est compatible avec le paginator, ce qui permet de paginer simplement les résultats comme n&#8217;importe quel autre sources !<br />
Ceci est une petite approche rapide, mais qui permet déjà d&#8217;instaurer rapidement un moteur de recherche sur votre site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/utiliser-zend_search_lucene-pour-creer-son-propre-moteur-de-recherche/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Serveur Dédié Debian Etch 64bit chez OVH &#8211; Installation d&#8217;Apache 2, PHP5, et phpMyAdmin</title>
		<link>http://www.anthor.net/blog/gnulinux/serveur-dedie-debian-etch-64bit-chez-ovh-installation-dapache-2-php5-et-phpmyadmin/</link>
		<comments>http://www.anthor.net/blog/gnulinux/serveur-dedie-debian-etch-64bit-chez-ovh-installation-dapache-2-php5-et-phpmyadmin/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 09:30:34 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=337</guid>
		<description><![CDATA[Pour installer Apache 2 : apt-get install apache2 apache2-mpm-prefork apache2-utils apache2-prefork-dev Puis installer PHP 5 : apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-mhash php5-mysql Éditer le fichier /etc/apache2/ports.conf et ajouter la ligne : Listen 443 Effectuez les commandes suivantes pour activer les modules SSL, Rewrite, Suexec et Include [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.anthor.net/wp-content/uploads/2008/10/fab.os_.logo_.apache.200.150.jpg" alt="" title="" width="200" height="150" class="alignleft size-full wp-image-339" /><br />
Pour installer Apache 2 :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> apache2 apache2-mpm-prefork apache2-utils apache2-prefork-dev</pre></div></div>

<p>Puis installer PHP 5 :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-mhash php5-mysql</pre></div></div>

<p><span id="more-337"></span><br />
Éditer le fichier /etc/apache2/ports.conf et ajouter la ligne :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Listen <span style="color: #000000;">443</span></pre></div></div>

<p>Effectuez les commandes suivantes pour activer les modules SSL, Rewrite, Suexec et Include :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">a2enmod ssl
a2enmod rewrite
a2enmod suexec
a2enmod include</pre></div></div>

<p>Je souhaite maintenant mettre en place les extensions PECL_HTTP, Fileinfo et APC op cache.<br />
Pour préparer leur installation, j&#8217;ai besoin de quelques outils supplémentaires :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> curl libcurl3-gnutls-dev libmagic-dev
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>apxs2 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>apxs
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>file<span style="color: #000000; font-weight: bold;">/</span>magic <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>magic.mime</pre></div></div>

<p>Puis je compile les extensions :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pecl <span style="color: #c20cb9; font-weight: bold;">install</span> pecl_http
pecl <span style="color: #c20cb9; font-weight: bold;">install</span> fileinfo
pecl <span style="color: #c20cb9; font-weight: bold;">install</span> apc</pre></div></div>

<p>Pour activer les extensions et effectuer quelques configurations, j&#8217;édite le fichier /etc/php5/apache2/php.ini :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">expose_php = On
magic_quotes_gpc = Off
default_charset = <span style="color: #ff0000;">&quot;utf-8&quot;</span>
allow_url_include = On
extension = http.so
extension = fileinfo.so
extension = apc.so</pre></div></div>

<p>Installer phpMyAdmin :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> phpmyadmin</pre></div></div>

<p>Et enfin redémarrer Apache <img src='http://www.anthor.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/gnulinux/serveur-dedie-debian-etch-64bit-chez-ovh-installation-dapache-2-php5-et-phpmyadmin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sécuriser les appels Paybox, avec CURL</title>
		<link>http://www.anthor.net/blog/developpement/securiser-les-appels-paybox-avec-curl/</link>
		<comments>http://www.anthor.net/blog/developpement/securiser-les-appels-paybox-avec-curl/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 07:50:24 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[CURL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=279</guid>
		<description><![CDATA[On a beau avoir une documentation de plus de 60 pages, on ne connait pas forcement les normes xHTML, ou la façon de sécuriser simplement un script ^^ Par défaut, la documentation de Paybox indique un simple formulaire HTML afin de transmettre les variables d&#8217;appels à la boutique. Très rapidement, on voit que les variables [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.anthor.net/wp-content/uploads/2008/09/logo_paybox.gif" alt="" title="" width="150" height="59" class="alignleft size-full wp-image-281" /><br />
On a beau avoir une documentation de plus de 60 pages, on ne connait pas forcement les normes xHTML, ou la façon de sécuriser simplement un script ^^</p>
<p>Par défaut, la documentation de Paybox indique un simple formulaire HTML afin de transmettre les variables d&#8217;appels à la boutique.<br />
Très rapidement, on voit que les variables sont donc tout à fait publiques, un simple copier/coller suffit à récupérer le formulaire et modifier les variables d&#8217;appels.</p>
<p>Afin de sécuriser le tout, nous allons utiliser CURL, afin de masquer l&#8217;emplacement du CGI, et masquer nos variables.<br />
De cette manière le traitement entier de l&#8217;appel du CGI à la redirection se fera côté serveur, et non plus côté client.</p>
<p><span id="more-279"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
*	Paramètres Paybox
*/</span>
<span style="color: #000088;">$PBX_MODE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_LANGUE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'FRA'</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// FRA French</span>
<span style="color: #000088;">$PBX_SITE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1999888'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_RANG</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'99'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_IDENTIFIANT</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'2'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_TOTAL</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'total_a_payer'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// *100</span>
<span style="color: #000088;">$PBX_DEVISE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'978'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_CMD</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_pad</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'command_number'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">,</span> STR_PAD_LEFT <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_PORTEUR</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'client_coords'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'email'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_RETOUR</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;numauto:A;transac:T;id:R&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_EFFECTUE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.maboutique.com/commande-ok.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_REFUSE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.maboutique.com/commande-refuse.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX_ANNULE</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.maboutique.com/commande-annule.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$PBX</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PBX_MODE=<span style="color: #006699; font-weight: bold;">$PBX_MODE</span>&amp;PBX_LANGUE=<span style="color: #006699; font-weight: bold;">$PBX_LANGUE</span>&amp;PBX_SITE=<span style="color: #006699; font-weight: bold;">$PBX_SITE</span>&amp;PBX_RANG=<span style="color: #006699; font-weight: bold;">$PBX_RANG</span>&amp;PBX_IDENTIFIANT=<span style="color: #006699; font-weight: bold;">$PBX_IDENTIFIANT</span>&amp;PBX_TOTAL=<span style="color: #006699; font-weight: bold;">$PBX_TOTAL</span>&amp;PBX_DEVISE=<span style="color: #006699; font-weight: bold;">$PBX_DEVISE</span>&amp;PBX_CMD=<span style="color: #006699; font-weight: bold;">$PBX_CMD</span>&amp;PBX_PORTEUR=<span style="color: #006699; font-weight: bold;">$PBX_PORTEUR</span>&amp;PBX_EFFECTUE=<span style="color: #006699; font-weight: bold;">$PBX_EFFECTUE</span>&amp;PBX_REFUSE=<span style="color: #006699; font-weight: bold;">$PBX_REFUSE</span>&amp;PBX_ANNULE=<span style="color: #006699; font-weight: bold;">$PBX_ANNULE</span>&amp;PBX_RETOUR=<span style="color: #006699; font-weight: bold;">$PBX_RETOUR</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$MOD</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.maboutique.com/cgi-bin/module-paybox.cgi&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$MOD</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_HEADER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POST<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_POSTFIELDS<span style="color: #339933;">,</span> <span style="color: #000088;">$PBX</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//echo $data; // DEBUG</span>
&nbsp;
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$ch</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>C&#8217;est toujours mieux qu&#8217;un formulaire HTML lorsque l&#8217;on dispose de la librairie CURL. De plus il existe d&#8217;autres moyens toujours plus sécurisés que le simple formulaire.</p>
<p>Rappelons tout de même que Paybox propose des solutions de paiement en ligne très intéressante et faciles à mettre en place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/securiser-les-appels-paybox-avec-curl/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SimpleXML  pour générer des cartes de densités géographiques</title>
		<link>http://www.anthor.net/blog/developpement/simplexml-pour-generer-des-cartes-de-densites-geographiques/</link>
		<comments>http://www.anthor.net/blog/developpement/simplexml-pour-generer-des-cartes-de-densites-geographiques/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 15:45:02 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SimpleXML]]></category>

		<guid isPermaLink="false">http://www.anthor.net/?p=161</guid>
		<description><![CDATA[Voilà premier essai de l&#8217;utilisation de SimpleXML, en reprenant ma base de carte pour l&#8217;association BC Concept ! J&#8217;ai donc écrit une classe pour générer des cartes de densités géographiques, ou de tout polygones. Les premiers essais sont visibles ici : Densité de population de l&#8217;Europe Densité de population de la France Densité de population [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.anthor.net/wp-content/uploads/2008/02/mapxml-europe.jpg" alt="" title="" width="175" height="206" class="alignleft size-full wp-image-163" /><br />
Voilà premier essai de l&#8217;utilisation de SimpleXML, en reprenant ma base de carte pour l&#8217;association BC Concept !<br />
J&#8217;ai donc écrit une classe pour générer des cartes de densités géographiques, ou de tout polygones.</p>
<p>Les premiers essais sont visibles ici :</p>
<ul>
<li><a href="http://www.anthor.net/labs/polygonmapgd/europe/">Densité de population de l&#8217;Europe</a></li>
<li><a href="http://www.anthor.net/labs/polygonmapgd/france/">Densité de population de la France</a></li>
<li><a href="http://www.anthor.net/labs/polygonmapgd/belgique/">Densité de population de la Belgique</a></li>
</ul>
<p>La classe permet d&#8217;éditer, de sauvegarder et d&#8217;afficher la carte inscrite dans le fichier XML traité.<br />
Le code retourné est au format xHTML et compatible DOM, ce qui vous permet d&#8217;ajouter une couche javascript pour afficher des informations supplémentaires.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/simplexml-pour-generer-des-cartes-de-densites-geographiques/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Carte de l&#8217;Europe en PHP avec GD 2.0</title>
		<link>http://www.anthor.net/blog/developpement/carte-de-leurope-en-php-avec-gd-2-0/</link>
		<comments>http://www.anthor.net/blog/developpement/carte-de-leurope-en-php-avec-gd-2-0/#comments</comments>
		<pubDate>Sat, 26 May 2007 13:45:47 +0000</pubDate>
		<dc:creator>Anthor</dc:creator>
				<category><![CDATA[Développement]]></category>
		<category><![CDATA[GD 2.0]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=65</guid>
		<description><![CDATA[Une carte de l&#8217;Europe entièrement dynamique a été développée spécialement pour l&#8217;association BC Concept. Celle-ci permet de se placer grâce à un formulaire dans l’un des 36 pays de l&#8217;Europe géographique. Actuellement seulement la France et la Belgique possèdent leurs propres cartes, mais d’autres viendront très prochainement. Explications : Les cartes sont mises à jour [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/wp-content/uploads/2010/03/www.burncrewconcept_net_carte.jpg" alt="" title="" width="150" height="176" class="alignleft size-full wp-image-64" /><br />
Une carte de l&#8217;Europe entièrement dynamique a été développée spécialement pour l&#8217;association BC Concept.</p>
<p>Celle-ci permet de se placer grâce à  un formulaire dans l’un des 36 pays de l&#8217;Europe géographique.</p>
<p>Actuellement seulement la France et la Belgique possèdent leurs propres cartes, mais d’autres viendront très prochainement.<br />
<span id="more-65"></span><br />
<strong><ins>Explications :</ins></strong><br />
Les cartes sont mises à  jour une fois par heure sur le serveur, à partir de la base de données des utilisateurs inscrits.<br />
Elles sont générées grâce à l’utilisation de la librairie GD 2.0, en utilisant une classe contenant tous les polygones nécessaires à chaque région.<br />
Le même principe est appliqué pour les pays détaillés.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anthor.net/blog/developpement/carte-de-leurope-en-php-avec-gd-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

