<?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>William&#039;s Blog &#187; Script</title> <atom:link href="http://www.willdurand.fr/tag/script/feed/" rel="self" type="application/rss+xml" /><link>http://www.willdurand.fr</link> <description>Développeur web indépendant, étudiant et passionné ! #Symfony2 #Rails #Diem #Git #Nginx #WebPerfs #SoftwareQuality</description> <lastBuildDate>Thu, 20 Oct 2011 14:59:05 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</title><link>http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql</link> <comments>http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/#comments</comments> <pubDate>Wed, 07 Jul 2010 12:24:14 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Serveur]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[Dedibox]]></category> <category><![CDATA[Rsync]]></category> <category><![CDATA[Script]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=487</guid> <description><![CDATA[Bonjour, suite à mon passage en dédié (Dédibox v3) et à sa configuration aujourd&#8217;hui terminée, j&#8217;ai trouvé nécessaire de m&#8217;occuper de la sauvegarde des données. Pour cela, je me suis aidé de plusieurs sources : http://www.ruas-blog.com/index.php/2006/03/06/33-script-de-sauvegarde-des-bases-mysql (pour backuper MySQL) http://www.casafire.com/fr/content/sauvegarde-incrémentale-de-fichiers-avec-rsync-et-ssh (pour backuper les fichiers) http://blog.mazenod.fr/2007/10/sauvegarde-cryptee-de-serveur-a-serveur/ (pour me rappeler les commandes d&#8217;usage) Sauvegarde des bases MySQL [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Bonjour, suite à mon passage en dédié (Dédibox v3) et à sa configuration aujourd&#8217;hui terminée, j&#8217;ai trouvé nécessaire de m&#8217;occuper de la sauvegarde des données. Pour cela, je me suis aidé de plusieurs sources :</p><ul><li><a
href="http://www.ruas-blog.com/index.php/2006/03/06/33-script-de-sauvegarde-des-bases-mysql">http://www.ruas-blog.com/index.php/2006/03/06/33-script-de-sauvegarde-des-bases-mysql</a> (pour backuper MySQL)</li><li><a
href="http://www.casafire.com/fr/content/sauvegarde-incr%C3%A9mentale-de-fichiers-avec-rsync-et-ssh">http://www.casafire.com/fr/content/sauvegarde-incrémentale-de-fichiers-avec-rsync-et-ssh</a> (pour backuper les fichiers)</li><li><a
href="http://blog.mazenod.fr/2007/10/sauvegarde-cryptee-de-serveur-a-serveur/">http://blog.mazenod.fr/2007/10/sauvegarde-cryptee-de-serveur-a-serveur/</a> (pour me rappeler les commandes d&#8217;usage)</li></ul><h2>Sauvegarde des bases MySQL</h2><p
style="text-align: justify;">Je sauvegarde toutes les bases de données sur une <strong>durée d&#8217;une semaine</strong>. Voici le script, il est possible de le coupler à un envoi de la sauvegarde via FTP. Je conserve ainsi toutes mes sauvegardes sur un serveur distant et complètement déconnecté de ce dont je vais vous parler ensuite.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;">#!/bin/bash</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <span
style="color: #666666; font-style: italic;"># Paramétrage de la connection MySQL &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#Nom de l'utilisateur qui lance le backup</span><br
/> <span
style="color: #007800;">user</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>user<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #666666; font-style: italic;">#Machine sur laquelle on se connecte</span><br
/> <span
style="color: #007800;">host</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>host<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #666666; font-style: italic;">#Mot de passe de l'utilisateur de backup</span><br
/> <span
style="color: #007800;">pass</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>password<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Outil de dump</span><br
/> <span
style="color: #007800;">MYSQLDUMP</span>=mysqldump<br
/> <span
style="color: #666666; font-style: italic;">#Outil de check</span><br
/> <span
style="color: #007800;">MYSQLCHECK</span>=mysqlcheck<br
/> <span
style="color: #666666; font-style: italic;"># Options passées à MYSQLDUMP</span><br
/> <span
style="color: #007800;">OPTIONS</span>=<span
style="color: #ff0000;">&quot;--add-drop-database &nbsp;--add-drop-table --complete-insert --routines --triggers --max_allowed_packet=250M --force&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <span
style="color: #666666; font-style: italic;"># Paramétrage de la sauvegarde &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Répertoire temporaire pour stocker les backups</span><br
/> <span
style="color: #007800;">TEMPORAIRE</span>=<span
style="color: #ff0000;">&quot;/tmp/bkp_mysql&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Nom du serveur</span><br
/> <span
style="color: #007800;">MACHINE</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(hostname)</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Date courante</span><br
/> <span
style="color: #007800;">DATE</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(date +&quot;%d-%m-%Y&quot;)</span>&quot;</span><br
/> <span
style="color: #666666; font-style: italic;"># Date de conservation maximum</span><br
/> <span
style="color: #007800;">DATE2</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> <span
style="color: #660033;">--date</span> <span
style="color: #ff0000;">'1 week ago'</span> <span
style="color: #ff0000;">&quot;+%d-%m-%Y&quot;</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Nom des fichiers de backup</span><br
/> <span
style="color: #666666; font-style: italic;"># Répertoire de destination du backup</span><br
/> <span
style="color: #007800;">DESTINATION</span>=<span
style="color: #ff0000;">&quot;/home/backuper/mysql&quot;</span><br
/> <span
style="color: #007800;">FICHIER_BACKUP</span>=<span
style="color: #007800;">$MACHINE</span><span
style="color: #ff0000;">&quot;_BACKUP_MYSQL_&quot;</span><span
style="color: #007800;">$DATE</span><span
style="color: #ff0000;">&quot;.tar.gz&quot;</span><br
/> <span
style="color: #007800;">FICHIER_EFFACER</span>=<span
style="color: #007800;">$MACHINE</span><span
style="color: #ff0000;">&quot;_BACKUP_MYSQL_&quot;</span><span
style="color: #007800;">$DATE2</span><span
style="color: #ff0000;">&quot;.tar.gz&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#Informations FTP</span><br
/> <span
style="color: #007800;">LOGIN_FTP</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>user_ftp<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #007800;">PASS_FTP</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>pass_ftp<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <span
style="color: #007800;">HOST_FTP</span>=<span
style="color: #000000; font-weight: bold;">&lt;</span>host_ftp<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <span
style="color: #666666; font-style: italic;"># Process de sauvegarde &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</span><br
/> <span
style="color: #666666; font-style: italic;">#---------------------------------------------------------------#</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Création du répertoire temporaire</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$TEMPORAIRE</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>;<br
/> <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Le repertoire temporaire existe.&quot;</span>;<br
/> <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">mkdir</span> <span
style="color: #007800;">$TEMPORAIRE</span>;<br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On construit la liste des bases de données</span><br
/> <span
style="color: #007800;">BASES</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(mysql -u $user -h $host -p$pass -Bse 'show databases')</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On lance le dump des bases</span><br
/> <span
style="color: #000000; font-weight: bold;">for</span> db <span
style="color: #000000; font-weight: bold;">in</span> <span
style="color: #007800;">$BASES</span><br
/> <span
style="color: #000000; font-weight: bold;">do</span><br
/> &nbsp; <span
style="color: #666666; font-style: italic;">#On lance un check et une analyse pour chaque base de données</span><br
/> &nbsp; <span
style="color: #007800;">$MYSQLCHECK</span> <span
style="color: #660033;">-u</span> <span
style="color: #007800;">$user</span> <span
style="color: #660033;">-h</span> <span
style="color: #007800;">$host</span> -p<span
style="color: #007800;">$pass</span> <span
style="color: #660033;">-c</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$db</span><br
/> &nbsp; <span
style="color: #666666; font-style: italic;"># On lance un mysqldump pour chaque base de données</span><br
/> &nbsp; <span
style="color: #007800;">$MYSQLDUMP</span> <span
style="color: #660033;">-u</span> <span
style="color: #007800;">$user</span> <span
style="color: #660033;">-h</span> <span
style="color: #007800;">$host</span> -p<span
style="color: #007800;">$pass</span> <span
style="color: #007800;">$OPTIONS</span> <span
style="color: #007800;">$db</span> <span
style="color: #660033;">-R</span> <span
style="color: #000000; font-weight: bold;">&gt;</span> <span
style="color: #007800;">$TEMPORAIRE</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$MACHINE</span><span
style="color: #ff0000;">&quot;-&quot;</span><span
style="color: #007800;">$db</span><span
style="color: #ff0000;">&quot;-&quot;</span><span
style="color: #007800;">$DATE</span><span
style="color: #ff0000;">&quot;.sql&quot;</span>;<br
/> <span
style="color: #000000; font-weight: bold;">done</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Création de l'archive contenant tout les dump</span><br
/> <span
style="color: #666666; font-style: italic;">#Cette archive est stockée dans le dossier défini pour la sauvegarde</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$DESTINATION</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <br
/> <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">cd</span> <span
style="color: #007800;">$TEMPORAIRE</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">tar</span> <span
style="color: #660033;">-cvzf</span> <span
style="color: #007800;">$DESTINATION</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$FICHIER_BACKUP</span> <span
style="color: #000000; font-weight: bold;">*</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On transfere l'archive par FTP</span><br
/> <span
style="color: #7a0874; font-weight: bold;">cd</span> <span
style="color: #007800;">$DESTINATION</span><br
/> <span
style="color: #c20cb9; font-weight: bold;">ftp</span> <span
style="color: #660033;">-v</span> <span
style="color: #660033;">-n</span> <span
style="color: #007800;">$HOST_FTP</span> <span
style="color: #000000; font-weight: bold;">&lt;</span> <span
style="color: #000000; font-weight: bold;">&lt;</span>SCRIPT<br
/> user <span
style="color: #007800;">$LOGIN_FTP</span> <span
style="color: #007800;">$PASS_FTP</span> <br
/> bin <br
/> put <span
style="color: #007800;">$FICHIER_BACKUP</span> <br
/> bye<br
/> SCRIPT<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On supprime le fichier de plus de x jours</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$DESTINATION</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$FICHIER_EFFACER</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #007800;">$DESTINATION</span><span
style="color: #ff0000;">&quot;/&quot;</span><span
style="color: #007800;">$FICHIER_EFFACER</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># On suprime le répertoire temporaire</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> fichier <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-Rf</span> <span
style="color: #007800;">$TEMPORAIRE</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span></div></div><h2></h2><h2>Sauvegarde incrémentale des fichiers avec rsync</h2><p
style="text-align: justify;">Je sauvegarde mes fichiers à la semaine de la façon suivante :</p><ul
style="text-align: justify;"><li>sauvegarde dans un répertoire nommé : <em>&lt;Année&gt;-&lt;Numéro de semaine&gt;</em></li><li>dans ce répertoire j&#8217;ai un dossier main qui contient l&#8217;intégralité des fichiers. Cette sauvegarde est faite le lundi.</li><li>j&#8217;ai 6 répertoires nommés : <em>&lt;jour&gt;_&lt;date au format jj-mm-aaaa&gt;</em> contenant les sauvegardes incrémentales de la semaine.</li></ul><p
style="text-align: justify;">J&#8217;ai modifié le script pour ajouter une conservation des <strong>sauvegardes de 4 semaines</strong>.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;">#!/bin/bash</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># - By default, the full backup is made monday, you can specify another day</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; by entering a number from 1 to 7 (1 is monday, 2 is tuesday ...) </span><br
/> <span
style="color: #666666; font-style: italic;">#FULL_DAY=1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># - BACKUP_LIST is a text file where you specify files/directories you </span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; want to backup (one per line), the paths on this file must be relative </span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; to the path set in BACKUP_ROOT</span><br
/> <span
style="color: #007800;">BACKUP_ROOT</span>=<span
style="color: #000000; font-weight: bold;">/</span><br
/> <span
style="color: #007800;">BACKUP_LIST</span>=<span
style="color: #ff0000;">&quot;/home/backuper/scripts/backup_list_files&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Excludes file</span><br
/> <span
style="color: #666666; font-style: italic;"># - Contains one wildcard pattern per line of files to exclude</span><br
/> <span
style="color: #666666; font-style: italic;"># - This is a rsync exclude file. See the rsync man page. &nbsp;</span><br
/> <span
style="color: #007800;">EXCLUDES_LIST</span>=<span
style="color: #ff0000;">&quot;/home/backuper/scripts/backup_exclude_files&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Hostname or IP adress of the remote backup server</span><br
/> <span
style="color: #007800;">BACKUP_SRV</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Port SSH</span><br
/> <span
style="color: #007800;">SSH_PORT</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Root directory that stores backups on the remote server</span><br
/> <span
style="color: #007800;">ARCHIVE_ROOT</span>=~<span
style="color: #000000; font-weight: bold;">/</span>files<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Remote user. Used by ssh. This is the user who connects to the remote backup server </span><br
/> <span
style="color: #666666; font-style: italic;"># Must have write access on $ARCHIVE_ROOT</span><br
/> <span
style="color: #007800;">REMOTE_USER</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Mail address for status updates</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;- This is used to email you a status report</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;- Comment it if you don't want to mail the report</span><br
/> <span
style="color: #007800;">MAILADDR</span>=<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Log file</span><br
/> <span
style="color: #007800;">LOGFILE</span>=<span
style="color: #ff0000;">&quot;/home/backuper/backup-files.log&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># HOSTNAME</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;This is used for creating a directory specific to this host on the remote host</span><br
/> <span
style="color: #007800;">HOSTNAME</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$(hostname)</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">#########################################</span><br
/> <span
style="color: #666666; font-style: italic;"># From here on out, you probably don't &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; want to change anything unless you &nbsp;#</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp; know what you're doing. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #</span><br
/> <span
style="color: #666666; font-style: italic;">#########################################</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; <span
style="color: #c20cb9; font-weight: bold;">touch</span> <span
style="color: #007800;">$LOGFILE</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Calculate WEEK_NUM</span><br
/> <span
style="color: #666666; font-style: italic;"># - This is the week number of year, it depends on the variable FULL_DAY</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;the value of FULL_DAY is considered as the first day of week</span><br
/> <span
style="color: #666666; font-style: italic;"># - By default the command `date +%W` considers monday as first day of week, so if the day of</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;the full backup is different from monday then we must make additional operations</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$FULL_DAY</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$FULL_DAY</span> <span
style="color: #660033;">-le</span> <span
style="color: #000000;">7</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>u<span
style="color: #000000; font-weight: bold;">`</span> <span
style="color: #660033;">-ge</span> <span
style="color: #007800;">$FULL_DAY</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span> <br
/> &nbsp; <span
style="color: #007800;">WEEK_NUM</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> $<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>W<span
style="color: #7a0874; font-weight: bold;">&#41;</span> + <span
style="color: #000000;">1</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; <span
style="color: #007800;">WEEK_NUM</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>W<span
style="color: #000000; font-weight: bold;">`</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># ARCHIVE_DIR</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;This is the directory (full path) of the current week backups (on the remote host)</span><br
/> <span
style="color: #666666; font-style: italic;"># &nbsp;The name of directory indicates the number of the week in the year (e.g 2007-32)</span><br
/> <span
style="color: #007800;">ARCHIVE_DIR</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$ARCHIVE_ROOT</span>/<span
style="color: #007800;">$HOSTNAME</span>/<span
style="color: #780078;">`date +%Y`</span>-<span
style="color: #007800;">$WEEK_NUM</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Directory which holds our current datastore</span><br
/> <span
style="color: #007800;">CURRENT</span>=main<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Directory which we save incremental changes to (e.g monday_06-08-2007)</span><br
/> <span
style="color: #007800;">INCREMENTDIR</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>A_<span
style="color: #000000; font-weight: bold;">%</span>d-<span
style="color: #000000; font-weight: bold;">%</span>m-<span
style="color: #000000; font-weight: bold;">%</span>Y<span
style="color: #000000; font-weight: bold;">`</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Options to pass to rsync</span><br
/> <span
style="color: #666666; font-style: italic;"># -r for recursivity must be explicite in spite of -a because --files-from (see man rsync)</span><br
/> <span
style="color: #007800;">OPTIONS</span>=<span
style="color: #ff0000;">&quot;--force --ignore-errors --delete --delete-excluded <span
style="color: #000099; font-weight: bold;">\<br
/> </span> --exclude-from=<span
style="color: #007800;">$EXCLUDES_LIST</span> --backup --backup-dir=<span
style="color: #007800;">$ARCHIVE_DIR</span>/<span
style="color: #007800;">$INCREMENTDIR</span> <span
style="color: #000099; font-weight: bold;">\<br
/> </span> -arhv --files-from=<span
style="color: #007800;">$BACKUP_LIST</span>&quot;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Our actual rsyncing function</span><br
/> do_rsync<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; rsync <span
style="color: #660033;">-e</span> <span
style="color: #ff0000;">&quot;ssh -p <span
style="color: #007800;">$SSH_PORT</span>&quot;</span> <span
style="color: #007800;">$OPTIONS</span> <span
style="color: #007800;">$BACKUP_ROOT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span>:<span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #000000;">2</span><span
style="color: #000000; font-weight: bold;">&gt;&amp;</span><span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; rsync <span
style="color: #007800;">$OPTIONS</span> <span
style="color: #007800;">$BACKUP_ROOT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span>:<span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #000000;">2</span><span
style="color: #000000; font-weight: bold;">&gt;&amp;</span><span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp;<span
style="color: #7a0874; font-weight: bold;">return</span> <br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Our post rsync accounting function</span><br
/> do_accounting<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$1</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Backup accounting for day <span
style="color: #007800;">$INCREMENTDIR</span> on <span
style="color: #007800;">$HOSTNAME</span>:&quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #660033;">-p</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">du</span> <span
style="color: #660033;">-s</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/*</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">du</span> <span
style="color: #660033;">-s</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/*</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">cat</span> <span
style="color: #007800;">$LOGFILE</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">grep</span> <span
style="color: #ff0000;">&quot;rsync: &quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> <br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Mail $1 -s &quot;</span><span
style="color: #007800;">$HOSTNAME</span> Backup Report<span
style="color: #ff0000;">&quot; &lt; /tmp/rsync_script_tmpfile&quot;</span><br
/> &nbsp; &nbsp; mail <span
style="color: #007800;">$1</span> <span
style="color: #660033;">-s</span> <span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$HOSTNAME</span> Backup Report&quot;</span> <span
style="color: #000000; font-weight: bold;">&lt;</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> <br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;rm /tmp/rsync_script_tmpfile&quot;</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #000000; font-weight: bold;">/</span>tmp<span
style="color: #000000; font-weight: bold;">/</span>rsync_script_tmpfile<br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Clean old backups</span><br
/> do_clean<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># Nb weeks</span><br
/> &nbsp; &nbsp; <span
style="color: #007800;">NB_WEEKS_MAX</span>=<span
style="color: #000000;">4</span><br
/> &nbsp; &nbsp; <span
style="color: #007800;">LIMIT</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> <span
style="color: #007800;">$WEEK_NUM</span> - <span
style="color: #007800;">$NB_WEEKS_MAX</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$LIMIT</span> <span
style="color: #660033;">-le</span> <span
style="color: #000000;">0</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">NB</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> <span
style="color: #007800;">$NB_WEEKS_MAX</span> - <span
style="color: #007800;">$WEEK_NUM</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">NB</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> <span
style="color: #000000;">52</span> - <span
style="color: #007800;">$NB</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">LAST_YEAR</span>=<span
style="color: #000000; font-weight: bold;">`</span><span
style="color: #c20cb9; font-weight: bold;">expr</span> $<span
style="color: #7a0874; font-weight: bold;">&#40;</span><span
style="color: #c20cb9; font-weight: bold;">date</span> +<span
style="color: #000000; font-weight: bold;">%</span>Y<span
style="color: #7a0874; font-weight: bold;">&#41;</span> - <span
style="color: #000000;">1</span><span
style="color: #000000; font-weight: bold;">`</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">TO_DELETE_DIR</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$ARCHIVE_ROOT</span>/<span
style="color: #007800;">$HOSTNAME</span>/<span
style="color: #007800;">$LAST_YEAR</span>-<span
style="color: #007800;">$NB</span>&quot;</span><br
/> <br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$TO_DELETE_DIR</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;rm -rf <span
style="color: #007800;">$TO_DELETE_DIR</span>&quot;</span> &nbsp; <br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-rf</span> <span
style="color: #007800;">$TO_DELETE_DIR</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">TO_DELETE_DIR</span>=<span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$ARCHIVE_ROOT</span>/<span
style="color: #007800;">$HOSTNAME</span>/<span
style="color: #780078;">`date +%Y`</span>-<span
style="color: #007800;">$LIMIT</span>&quot;</span><br
/> <br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$TO_DELETE_DIR</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;rm -rf <span
style="color: #007800;">$TO_DELETE_DIR</span>&quot;</span> &nbsp; <br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">rm</span> <span
style="color: #660033;">-rf</span> <span
style="color: #007800;">$TO_DELETE_DIR</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Some error handling and/or run our backup and accounting</span><br
/> <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$BACKUP_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$EXCLUDES_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$BACKUP_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span>; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #660033;">-f</span> <span
style="color: #007800;">$EXCLUDES_LIST</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #666666; font-style: italic;"># make sure our backup tree exists</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #660033;">-p</span> <span
style="color: #007800;">$SSH_PORT</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">install</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; <span
style="color: #c20cb9; font-weight: bold;">ssh</span> <span
style="color: #007800;">$REMOTE_USER</span><span
style="color: #000000; font-weight: bold;">@</span><span
style="color: #007800;">$BACKUP_SRV</span> <span
style="color: #c20cb9; font-weight: bold;">install</span> <span
style="color: #660033;">-d</span> <span
style="color: #007800;">$ARCHIVE_DIR</span><span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$CURRENT</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;=========================================================&quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;<span
style="color: #780078;">`date`</span> : Backup started.&quot;</span> <span
style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; do_rsync <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">if</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span> <span
style="color: #007800;">$?</span> <span
style="color: #660033;">-eq</span> <span
style="color: #000000;">0</span> <span
style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span
style="color: #000000; font-weight: bold;">then</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;OK. Backup succeeded&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do_clean<br
/> &nbsp; &nbsp; do_accounting <span
style="color: #007800;">$MAILADDR</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">0</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;Backup failed. See <span
style="color: #007800;">$LOGFILE</span> for debug info.&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; do_accounting <span
style="color: #007800;">$MAILADDR</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$EXCLUDES_LIST</span>: File not found or not a regular file. Backup aborted&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span>; <br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;<span
style="color: #007800;">$BACKUP_LIST</span>: File not found or not a regular file. Backup aborted&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;You must edit the script file and set the variable EXCLUDES_LIST&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <span
style="color: #000000; font-weight: bold;">else</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">echo</span> <span
style="color: #ff0000;">&quot;You must edit the script file and set the variable BACKUP_LIST&quot;</span> <span
style="color: #000000; font-weight: bold;">|</span> <span
style="color: #c20cb9; font-weight: bold;">tee</span> <span
style="color: #660033;">-a</span> <span
style="color: #007800;">$LOGFILE</span><br
/> &nbsp; <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">1</span><br
/> <span
style="color: #000000; font-weight: bold;">fi</span><br
/> <br
/> <span
style="color: #7a0874; font-weight: bold;">exit</span> <span
style="color: #000000;">2</span></div></div><p
style="text-align: justify;">Je sauvegarde ces fichiers :</p><div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var/www<br
/> var/log<br
/> etc/apache2<br
/> etc/apt/sources.list<br
/> etc/fstab<br
/> etc/crontab<br
/> etc/hostname<br
/> etc/hosts<br
/> etc/group<br
/> etc/memcached.conf<br
/> etc/mysql<br
/> etc/nginx<br
/> etc/php5<br
/> etc/phpmyadmin<br
/> etc/postfix<br
/> etc/ssh<br
/> etc/fail2ban<br
/> home</div></div><p
style="text-align: justify;">Et j&#8217;exclue ceux-là :</p><div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">home/backuper/backup-files.log<br
/> home/backuper/files<br
/> etc/mysql/debian.cnf<br
/> etc/ssh/ssh_host*<br
/> etc/phpmyadmin/htpasswd.setup<br
/> .*_history<br
/> .Xauthority<br
/> .lesshst<br
/> .ssh</div></div><p
style="text-align: justify;"></p><h2>Automatisation</h2><p
style="text-align: justify;">J&#8217;ai rajouté dans mon <em>crontab</em>, deux lignes pour lancer les sauvegardes différées de 2h :</p><p
style="text-align: justify;"></p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000;">0</span> <span
style="color: #000000;">1</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">/</span>home<span
style="color: #000000; font-weight: bold;">/</span>backuper<span
style="color: #000000; font-weight: bold;">/</span>scripts<span
style="color: #000000; font-weight: bold;">/</span>backup_mysql.sh<br
/> <span
style="color: #000000;">0</span> <span
style="color: #000000;">3</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">*</span> <span
style="color: #000000; font-weight: bold;">/</span>home<span
style="color: #000000; font-weight: bold;">/</span>backuper<span
style="color: #000000; font-weight: bold;">/</span>scripts<span
style="color: #000000; font-weight: bold;">/</span>backup_files.sh</div></div><p></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/' title='Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL'>Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL</a></li><li><a
href='http://www.willdurand.fr/gravatar-de-beaux-avatars-dans-les-commentaires/' title='Gravatar : De beaux avatars dans les commentaires'>Gravatar : De beaux avatars dans les commentaires</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/' title='API Google Analytics – Une classe PHP5 et des résultats d’intégration'>API Google Analytics – Une classe PHP5 et des résultats d’intégration</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;bodytext=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;notes=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;t=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;annotation=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;t=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;body=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&title=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fsauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql%2F&amp;submitHeadline=Sauvegarde%20incr%C3%A9mentale%20avec%20rsync%20%3A%20fichiers%20et%20base%20de%20donn%C3%A9es%20MySQL&amp;submitSummary=Bonjour%2C%20suite%20%C3%A0%20mon%20passage%20en%20d%C3%A9di%C3%A9%20%28D%C3%A9dibox%20v3%29%20et%20%C3%A0%20sa%20configuration%20aujourd%27hui%20termin%C3%A9e%2C%20j%27ai%20trouv%C3%A9%20n%C3%A9cessaire%20de%20m%27occuper%20de%20la%20sauvegarde%20des%20donn%C3%A9es.%20Pour%20cela%2C%20je%20me%20suis%20aid%C3%A9%20de%20plusieurs%20sources%20%3A%0D%0A%0D%0A%09http%3A%2F%2Fwww.ruas-blog.com%2F&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/feed/</wfw:commentRss> <slash:comments>10</slash:comments> </item> <item><title>Gravatar : De beaux avatars dans les commentaires</title><link>http://www.willdurand.fr/gravatar-de-beaux-avatars-dans-les-commentaires/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=gravatar-de-beaux-avatars-dans-les-commentaires</link> <comments>http://www.willdurand.fr/gravatar-de-beaux-avatars-dans-les-commentaires/#comments</comments> <pubDate>Tue, 26 May 2009 17:51:01 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[Avatar]]></category> <category><![CDATA[Gravatar]]></category> <category><![CDATA[Script]]></category> <category><![CDATA[Wordpress]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[Gravatar pour Globally Recognized Avatar est un service qui permet d&#8217;utiliser un avatar sur les sites WordPress en identifiant l&#8217;email de la personne qui a écrit. Je me suis souvent demandé comment, sans enregistrement, certaines personnes avaient leur avatar dans les commentaires d&#8217;un blog mais je n&#8217;ai jamais pris la peine de chercher plus. C&#8217;est [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/gravatar.jpg" rel="lightbox[27]" title="gravatar"><img
class="alignleft size-thumbnail wp-image-197" title="gravatar" src="http://www.willdurand.fr/wp-content/uploads/2010/07/gravatar-150x150.jpg" alt="" width="150" height="150" /></a><strong>Gravatar</strong> pour <strong>G</strong>lobally <strong>R</strong>ecognized <strong>Avatar </strong>est un service qui permet d&#8217;utiliser un avatar sur les sites WordPress en identifiant l&#8217;email de la personne qui a écrit.</p><p
style="text-align: justify;">Je me suis souvent demandé comment, sans enregistrement, certaines personnes avaient leur avatar dans les commentaires d&#8217;un blog mais je n&#8217;ai jamais pris la peine de chercher plus.</p><p
style="text-align: justify;">C&#8217;est aujourd&#8217;hui chose faite, et j&#8217;ai intégré tout ça dans mon blog.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"></p><p
style="text-align: justify;">L&#8217;intégration est très aisée. Elle est basée sur cet article : <a
title="Intégrer Gravatar sans plugin" href="http://www.wordpress-fr.net/blog/wordpress/integrer-gravatar-sans-plugin">http://www.wordpress-fr.net/blog/wordpress/integrer-gravatar-sans-plugin</a>.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Il m&#8217;a suffit de rajouter un champs <em>email </em>dans le formulaire d&#8217;ajout d&#8217;un commentaire.</p><p
style="text-align: justify;">Ensuite j&#8217;ai modifié un peu le template en testant si ce champs est nul ou non. S&#8217;il n&#8217;est pas nul, je tente de charger l&#8217;avatar depuis Gravatar. L&#8217;identification au service Gravatar se fait simplement avec le <strong>hash md5</strong> de l&#8217;email :</p><div
class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;<a
href="http://december.com/html/4/element/img.html"><span
style="color: #000000; font-weight: bold;">img</span></a> <span
style="color: #000066;">src</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.gravatar.com/avatar.php?gravatar_id=__HASH_MD5__&amp;size=42&quot;</span> <span
style="color: #000066;">alt</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;avatar&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span></div></div><p
style="text-align: justify;"></p><p>&lt;</p><p>p style=&nbsp;&raquo;text-align: justify;&nbsp;&raquo;>Et voilà comment obtenir un peu plus d&#8217;ergonomie dans les commentaires, et ceci sans devoir créer une zone membre ou autre. C&#8217;est complètement transparent pour l&#8217;utilisateur, je trouve ça génial.&lt;/p<h3 class='related_post_title'>Related Posts</h3></p><ul
class='related_post'><li><a
href='http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/' title='Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL'>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/' title='API Google Analytics – Une classe PHP5 et des résultats d’intégration'>API Google Analytics – Une classe PHP5 et des résultats d’intégration</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li><li><a
href='http://www.willdurand.fr/decouverte-des-webservices-en-php/' title='Découverte des WebServices en PHP'>Découverte des WebServices en PHP</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;bodytext=Gravatar%20pour%20Globally%20Recognized%20Avatar%20est%20un%20service%20qui%20permet%20d%27utiliser%20un%20avatar%20sur%20les%20sites%20Wordpress%20en%20identifiant%20l%27email%20de%20la%20personne%20qui%20a%20%C3%A9crit.%0D%0AJe%20me%20suis%20souvent%20demand%C3%A9%20comment%2C%20sans%20enregistrement%2C%20certaines%20personnes%20avaient" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;notes=Gravatar%20pour%20Globally%20Recognized%20Avatar%20est%20un%20service%20qui%20permet%20d%27utiliser%20un%20avatar%20sur%20les%20sites%20Wordpress%20en%20identifiant%20l%27email%20de%20la%20personne%20qui%20a%20%C3%A9crit.%0D%0AJe%20me%20suis%20souvent%20demand%C3%A9%20comment%2C%20sans%20enregistrement%2C%20certaines%20personnes%20avaient" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;t=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;annotation=Gravatar%20pour%20Globally%20Recognized%20Avatar%20est%20un%20service%20qui%20permet%20d%27utiliser%20un%20avatar%20sur%20les%20sites%20Wordpress%20en%20identifiant%20l%27email%20de%20la%20personne%20qui%20a%20%C3%A9crit.%0D%0AJe%20me%20suis%20souvent%20demand%C3%A9%20comment%2C%20sans%20enregistrement%2C%20certaines%20personnes%20avaient" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Gravatar%20pour%20Globally%20Recognized%20Avatar%20est%20un%20service%20qui%20permet%20d%27utiliser%20un%20avatar%20sur%20les%20sites%20Wordpress%20en%20identifiant%20l%27email%20de%20la%20personne%20qui%20a%20%C3%A9crit.%0D%0AJe%20me%20suis%20souvent%20demand%C3%A9%20comment%2C%20sans%20enregistrement%2C%20certaines%20personnes%20avaient" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;t=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;body=Gravatar%20pour%20Globally%20Recognized%20Avatar%20est%20un%20service%20qui%20permet%20d%27utiliser%20un%20avatar%20sur%20les%20sites%20Wordpress%20en%20identifiant%20l%27email%20de%20la%20personne%20qui%20a%20%C3%A9crit.%0D%0AJe%20me%20suis%20souvent%20demand%C3%A9%20comment%2C%20sans%20enregistrement%2C%20certaines%20personnes%20avaient" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&title=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fgravatar-de-beaux-avatars-dans-les-commentaires%2F&amp;submitHeadline=Gravatar%20%3A%20De%20beaux%20avatars%20dans%20les%20commentaires&amp;submitSummary=Gravatar%20pour%20Globally%20Recognized%20Avatar%20est%20un%20service%20qui%20permet%20d%27utiliser%20un%20avatar%20sur%20les%20sites%20Wordpress%20en%20identifiant%20l%27email%20de%20la%20personne%20qui%20a%20%C3%A9crit.%0D%0AJe%20me%20suis%20souvent%20demand%C3%A9%20comment%2C%20sans%20enregistrement%2C%20certaines%20personnes%20avaient&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/gravatar-de-beaux-avatars-dans-les-commentaires/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>API Google Analytics – Une classe PHP5 et des résultats d’intégration</title><link>http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=api-google-analytics-une-classe-php5-et-des-resultats-d-integration</link> <comments>http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/#comments</comments> <pubDate>Mon, 27 Apr 2009 11:42:35 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[API]]></category> <category><![CDATA[Curl]]></category> <category><![CDATA[Design Pattern]]></category> <category><![CDATA[Google Analytics]]></category> <category><![CDATA[PHP 5]]></category> <category><![CDATA[Script]]></category> <category><![CDATA[Singleton]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[Pour intégrer Google Analytics à mon système de blog je me suis constitué une petite classe PHP5. Cette classe est implémentée selon le design pattern Singleton. Le constructeur dispose des identifiants de connexion en dur mais on peut très bien utiliser des constantes. class GAnalytics &#123; &#160; private $email; &#160; private $passwd; &#160; private $ids; &#160; [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/codelabs1.png" rel="lightbox[32]" title="codelabs"><img
class="alignleft size-full wp-image-303" title="codelabs" src="http://www.willdurand.fr/wp-content/uploads/2010/07/codelabs1.png" alt="" width="150" height="55" /></a>Pour intégrer Google Analytics à mon système de blog je me suis constitué une petite classe PHP5. Cette classe est implémentée selon le <strong>design pattern </strong><em>Singleton</em>. Le constructeur dispose des identifiants de connexion en dur mais on peut très bien utiliser des constantes.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">class</span> GAnalytics<br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$email</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$passwd</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$ids</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$auth</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> static <span
style="color: #000088;">$instance</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000000; font-weight: bold;">function</span> __construct<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">login</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'********@********'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'********'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'********'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000000; font-weight: bold;">function</span> __clone<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">public</span> static <span
style="color: #000000; font-weight: bold;">function</span> instance<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #339933;">!</span><a
href="http://www.php.net/isset"><span
style="color: #990000;">isset</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000000; font-weight: bold;">self</span><span
style="color: #339933;">::</span><span
style="color: #000088;">$instance</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$c</span> <span
style="color: #339933;">=</span> <span
style="color: #009900; font-weight: bold;">__CLASS__</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">self</span><span
style="color: #339933;">::</span><span
style="color: #000088;">$instance</span> <span
style="color: #339933;">=</span> <span
style="color: #000000; font-weight: bold;">new</span> <span
style="color: #000088;">$c</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">return</span> <span
style="color: #000000; font-weight: bold;">self</span><span
style="color: #339933;">::</span><span
style="color: #000088;">$instance</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000000; font-weight: bold;">function</span> login<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$email</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$passwd</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$ids</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">email</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$email</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">passwd</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$passwd</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">ids</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$ids</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #0000ff;">&quot;https://www.google.com/accounts/ClientLogin&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$data</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;">'accountType'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'GOOGLE'</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'Email'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">email</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'Passwd'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">passwd</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'source'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'CLI_GAnalytics'</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'service'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'analytics'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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;">$data</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;Auth=&quot;</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">auth</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">public</span> <span
style="color: #000000; font-weight: bold;">function</span> getDimensionByMetric<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$metrics</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$dimensions</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$date_1</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$date_2</span> <span
style="color: #339933;">=</span> <span
style="color: #009900; font-weight: bold;">null</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #339933;">!</span><span
style="color: #000088;">$date_2</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$date_2</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$date_1</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$metrics</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;dimensions=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$dimensions</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$date_1</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$date_2</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">auth</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$response</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$infos</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_getinfo"><span
style="color: #990000;">curl_getinfo</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$infos</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'http_code'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">!=</span> <span
style="color: #cc66cc;">200</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #b1b100;">throw</span> <span
style="color: #000000; font-weight: bold;">new</span> Exception<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;[EXCEPTION] (&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$info</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'http_code'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;) &quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$XML_object</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/simplexml_load_string"><span
style="color: #990000;">simplexml_load_string</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$data</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">''</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$label</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">''</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">foreach</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span> <span
style="color: #b1b100;">as</span> <span
style="color: #000088;">$m</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$tmp</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'ga:'</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$dimensions</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">'='</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">title</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$label</span> <span
style="color: #339933;">==</span> <span
style="color: #0000ff;">&quot;&quot;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$label</span> <span
style="color: #339933;">.=</span> <span
style="color: #000088;">$tmp</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">' ('</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">')'</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$data</span> <span
style="color: #339933;">.=</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #b1b100;">else</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$label</span> <span
style="color: #339933;">.=</span> <span
style="color: #0000ff;">'|'</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$tmp</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">' ('</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">')'</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$data</span> <span
style="color: #339933;">.=</span> <span
style="color: #0000ff;">','</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> &nbsp; &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">return</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;">'label'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$label</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'data'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$data</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">public</span> <span
style="color: #000000; font-weight: bold;">function</span> getMetric<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$metric</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$date_1</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$date_2</span> <span
style="color: #339933;">=</span> <span
style="color: #009900; font-weight: bold;">null</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #339933;">!</span><span
style="color: #000088;">$date_2</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$date_2</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$date_1</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$metric</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$date_1</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$date_2</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">auth</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$response</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$infos</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_getinfo"><span
style="color: #990000;">curl_getinfo</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$infos</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'http_code'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">!=</span> <span
style="color: #cc66cc;">200</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #b1b100;">throw</span> <span
style="color: #000000; font-weight: bold;">new</span> Exception<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;[EXCEPTION] (&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$info</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'http_code'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;) &quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$XML_object</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/simplexml_load_string"><span
style="color: #990000;">simplexml_load_string</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">return</span> <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> ? <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">public</span> <span
style="color: #000000; font-weight: bold;">function</span> getMetricURI<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$metric</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$uri</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$date_1</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$date_2</span> <span
style="color: #339933;">=</span> <span
style="color: #009900; font-weight: bold;">null</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #339933;">!</span><span
style="color: #000088;">$date_2</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #000088;">$date_2</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$date_1</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$metric</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;dimensions=ga:pagePath&amp;filters=ga:pagePath=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$uri</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$date_1</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$date_2</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">auth</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$response</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$infos</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_getinfo"><span
style="color: #990000;">curl_getinfo</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$infos</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'http_code'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">!=</span> <span
style="color: #cc66cc;">200</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">throw</span> <span
style="color: #000000; font-weight: bold;">new</span> Exception<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;[EXCEPTION] (&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$info</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'http_code'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;) &quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; &nbsp; <span
style="color: #000088;">$XML_object</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/simplexml_load_string"><span
style="color: #990000;">simplexml_load_string</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">return</span> <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> ? <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p>Pour récupérer une instance de cette classe on appelle la méthode statique <em>instance()</em> :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$ga</span> <span
style="color: #339933;">=</span> GAnalytics<span
style="color: #339933;">::</span><span
style="color: #004000;">instance</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></div><p>Ensuite on peut utiliser les méthodes comme dans l&#8217;exemple ci-dessous :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$navigateurs</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$ga</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">getDimensionByMetric</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'visits'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'browser'</span><span
style="color: #339933;">,</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$countries</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$ga</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">getDimensionByMetric</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'visits'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'country'</span><span
style="color: #339933;">,</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$visits</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$ga</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">getMetric</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'visits'</span><span
style="color: #339933;">,</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$unique_visits</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$ga</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">getMetric</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'visitors'</span><span
style="color: #339933;">,</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$page_views</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$ga</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">getMetric</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'pageviews'</span><span
style="color: #339933;">,</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></div><ul><li><strong>getDimensionByMetric()</strong> permet d&#8217;effectuer une requête avec un <em>metric </em>et une <em>dimension</em>.</li><li><strong>getMetric()</strong> permet d&#8217;effectuer une requête avec un <em>metric </em>uniquement.</li><li><strong>getMetricURI()</strong> permet d&#8217;effectuer une requête avec un <em>metric </em>par rapport à une <em>URI </em>précise.</li></ul><p>On passe soit un intervalle (une période), soit une seule date.</p><p>Cette classe et ces méthodes sont très perfectibles, mais elles me suffisent amplement pour une intégration basique de Google Analytics. Ceci m&#8217;a permis d&#8217;avoir le résultat suivant :</p><p
style="text-align: left;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/stats_willdurand1.png" rel="lightbox[32]" title="stats_willdurand"><img
class="aligncenter size-medium wp-image-304" title="stats_willdurand" src="http://www.willdurand.fr/wp-content/uploads/2010/07/stats_willdurand1-300x168.png" alt="" width="300" height="168" /></a>L&#8217;image ci-dessus présente ma page de statistiques dans ma partie administrateur du blog. On peut voir le nombre de visites au total, le nombre de pages vues et le nombres de visiteurs uniques, le tout sur la journée. J&#8217;ai aussi deux graphiques représentant les visites par navigateur et par pays.</p><p
style="text-align: left;"></p><p
style="text-align: left;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/stats_willdurand_21.png" rel="lightbox[32]" title="stats_willdurand_2"><img
class="aligncenter size-medium wp-image-305" title="stats_willdurand_2" src="http://www.willdurand.fr/wp-content/uploads/2010/07/stats_willdurand_21-300x132.png" alt="" width="300" height="132" /></a>L&#8217;image ci-dessus représente l&#8217;intégration de Google Analytics pour chacun de mes articles. On peut y voir le nombre de fois que cet article a été affiché, le nombre de consultations uniques ainsi que le temps moyen passé sur cet article, le tout sur la journée.</p><p
style="text-align: left;"></p><h3>Liens annexes :</h3><p
style="text-align: left;"><a
title="Découverte de l'API Google Analytics" href="http://www.willdurand.fr/api-google-analytics-decouverte-par-l-exemple/">http://www.willdurand.fr/api-google-analytics-decouverte-par-l-exemple/</a></p><p
style="text-align: left;"><a
title="Graphiques et statistiques Google Analytics" href="http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/">http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/</a></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li><li><a
href='http://www.willdurand.fr/decouverte-des-webservices-en-php/' title='Découverte des WebServices en PHP'>Découverte des WebServices en PHP</a></li><li><a
href='http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/' title='Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL'>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</a></li><li><a
href='http://www.willdurand.fr/un-mvc-en-php5-le-flux-d-entree/' title='Un MVC en PHP5 : le flux d’entrée'>Un MVC en PHP5 : le flux d’entrée</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;bodytext=Pour%20int%C3%A9grer%20Google%C2%A0Analytics%20%C3%A0%20mon%20syst%C3%A8me%20de%20blog%20je%20me%20suis%20constitu%C3%A9%20une%20petite%20classe%20PHP5.%20Cette%20classe%20est%20impl%C3%A9ment%C3%A9e%20selon%20le%20design%20pattern%20Singleton.%20Le%20constructeur%20dispose%20des%20identifiants%20de%20connexion%20en%20dur%20mais%20on%20peut%20tr%C3%A8s%20b" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;notes=Pour%20int%C3%A9grer%20Google%C2%A0Analytics%20%C3%A0%20mon%20syst%C3%A8me%20de%20blog%20je%20me%20suis%20constitu%C3%A9%20une%20petite%20classe%20PHP5.%20Cette%20classe%20est%20impl%C3%A9ment%C3%A9e%20selon%20le%20design%20pattern%20Singleton.%20Le%20constructeur%20dispose%20des%20identifiants%20de%20connexion%20en%20dur%20mais%20on%20peut%20tr%C3%A8s%20b" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;t=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;annotation=Pour%20int%C3%A9grer%20Google%C2%A0Analytics%20%C3%A0%20mon%20syst%C3%A8me%20de%20blog%20je%20me%20suis%20constitu%C3%A9%20une%20petite%20classe%20PHP5.%20Cette%20classe%20est%20impl%C3%A9ment%C3%A9e%20selon%20le%20design%20pattern%20Singleton.%20Le%20constructeur%20dispose%20des%20identifiants%20de%20connexion%20en%20dur%20mais%20on%20peut%20tr%C3%A8s%20b" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Pour%20int%C3%A9grer%20Google%C2%A0Analytics%20%C3%A0%20mon%20syst%C3%A8me%20de%20blog%20je%20me%20suis%20constitu%C3%A9%20une%20petite%20classe%20PHP5.%20Cette%20classe%20est%20impl%C3%A9ment%C3%A9e%20selon%20le%20design%20pattern%20Singleton.%20Le%20constructeur%20dispose%20des%20identifiants%20de%20connexion%20en%20dur%20mais%20on%20peut%20tr%C3%A8s%20b" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;t=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;body=Pour%20int%C3%A9grer%20Google%C2%A0Analytics%20%C3%A0%20mon%20syst%C3%A8me%20de%20blog%20je%20me%20suis%20constitu%C3%A9%20une%20petite%20classe%20PHP5.%20Cette%20classe%20est%20impl%C3%A9ment%C3%A9e%20selon%20le%20design%20pattern%20Singleton.%20Le%20constructeur%20dispose%20des%20identifiants%20de%20connexion%20en%20dur%20mais%20on%20peut%20tr%C3%A8s%20b" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&title=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-une-classe-php5-et-des-resultats-d-integration%2F&amp;submitHeadline=API%20Google%20Analytics%20%E2%80%93%20Une%20classe%20PHP5%20et%20des%20r%C3%A9sultats%20d%E2%80%99int%C3%A9gration&amp;submitSummary=Pour%20int%C3%A9grer%20Google%C2%A0Analytics%20%C3%A0%20mon%20syst%C3%A8me%20de%20blog%20je%20me%20suis%20constitu%C3%A9%20une%20petite%20classe%20PHP5.%20Cette%20classe%20est%20impl%C3%A9ment%C3%A9e%20selon%20le%20design%20pattern%20Singleton.%20Le%20constructeur%20dispose%20des%20identifiants%20de%20connexion%20en%20dur%20mais%20on%20peut%20tr%C3%A8s%20b&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>API Google Analytics Round 2 – Graphiques et statistiques par page</title><link>http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=api-google-analytics-round-2-graphiques-et-statistiques-par-page</link> <comments>http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/#comments</comments> <pubDate>Thu, 23 Apr 2009 18:03:16 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[API]]></category> <category><![CDATA[Chart]]></category> <category><![CDATA[Curl]]></category> <category><![CDATA[Google Analytics]]></category> <category><![CDATA[PHP 5]]></category> <category><![CDATA[Référencement]]></category> <category><![CDATA[Script]]></category> <category><![CDATA[SEO]]></category> <category><![CDATA[Yahoo UI]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[Après mes premiers essais d&#8217;hier, et mes idées d&#8217;implémentation dans mon système de blog, je me suis mis à l&#8217;oeuvre. J&#8217;ai donc ajouté un rendu au code d&#8217;hier (avec la librairie graphique de Google ici) et mis en place pour chacun de mes articles, des statistiques journalières. Graphique avec l&#8217;API Google Chart L&#8217;API Google Chart [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/google_analytics.png" rel="lightbox[30]" title="google_analytics"><img
class="size-full wp-image-211 aligncenter" title="google_analytics" src="http://www.willdurand.fr/wp-content/uploads/2010/07/google_analytics.png" alt="" width="450" height="353" /></a>Après mes premiers essais d&#8217;hier, et mes idées d&#8217;implémentation dans mon système de blog, je me suis mis à l&#8217;oeuvre. J&#8217;ai donc ajouté un rendu au code d&#8217;hier (avec la librairie graphique de Google <a
title="Google Chart API" href="http://code.google.com/intl/fr/apis/chart/basics.html">ici</a>) et mis en place pour chacun de mes articles, des statistiques journalières.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"></p><h3 style="text-align: justify;">Graphique avec l&#8217;API Google Chart</h3><p
style="text-align: justify;">L&#8217;API Google Chart est une API qui permet de créer des graphiques (format image) assez simplement. Le lien qui m&#8217;a été utile est le suivant : <a
title="API Google Chart - Charts Basic" href="http://code.google.com/intl/fr/apis/chart/basics.html">http://code.google.com/intl/fr/apis/chart/basics.html</a>. J&#8217;avais commencé avec <a
title="Yahoo UI - Charts" href="http://developer.yahoo.com/yui/charts/">Yahoo UI</a> que j&#8217;utilise régulièrement au travail, mais l&#8217;intérêt était moindre et je voulais consommer le moins de ressources possibles. Cependant YUI permet d&#8217;avoir des graphiques <strong>live</strong>, ce qui peut avoir son utilité.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Donc j&#8217;ai repris le code d&#8217;hier, je l&#8217;ai modifié un petit peu et voilà le résultat :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">&lt;?php</span><br
/> <br
/> <span
style="color: #000088;">$email</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'*******@*******'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$passwd</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'*******'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'*******'</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #0000ff;">&quot;https://www.google.com/accounts/ClientLogin&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$data</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;">'accountType'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'GOOGLE'</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'Email'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$email</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'Passwd'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$passwd</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'source'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'CLI_GAnalytics'</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'service'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'analytics'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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;">$data</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;Auth=&quot;</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$auth</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">=</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ch1</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:visits&amp;dimensions=ga:browser&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$auth</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HEADER<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$response</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$XML_object</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/simplexml_load_string"><span
style="color: #990000;">simplexml_load_string</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$data</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">''</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$label</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">''</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">foreach</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span> <span
style="color: #b1b100;">as</span> <span
style="color: #000088;">$m</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$tmp</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'ga:browser='</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">title</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$label</span> <span
style="color: #339933;">==</span> <span
style="color: #0000ff;">&quot;&quot;</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$label</span> <span
style="color: #339933;">.=</span> <span
style="color: #000088;">$tmp</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">' ('</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">')'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$data</span> <span
style="color: #339933;">.=</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #b1b100;">else</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$label</span> <span
style="color: #339933;">.=</span> <span
style="color: #0000ff;">'|'</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$tmp</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">' ('</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">')'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$data</span> <span
style="color: #339933;">.=</span> <span
style="color: #0000ff;">','</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'<br
/> &lt;img src=&quot;http://chart.apis.google.com/chart?<br
/> chs=400x150<br
/> &amp;amp;chd=t:'</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$data</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">'<br
/> &amp;amp;cht=p3<br
/> &amp;amp;chdl='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$label</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">'&quot;<br
/> alt=&quot;Sample chart&quot; /&gt;<br
/> '</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Ce qui permet d&#8217;obtenir ce genre de graphique :</p><p
style="text-align: center;"><img
class="aligncenter" title="API Google Analytics - Graphique des navigateurs du jour" src="http://chart.apis.google.com/chart?chs=400x150&#038;chd=t:1,9,1&#038;cht=p3&#038;chdl=Chrome%20(1)|Firefox%20(9)|Opera%20(1)" alt="API Google Analytics - Graphique des navigateurs du jour" width="400" height="150" /></p><p
style="text-align: center;"><img
class="aligncenter" title="API Google Analytics - Graphique des navigateurs du jour 2" src="http://chart.apis.google.com/chart?chs=400x150&#038;chd=t:12,2,1,1&#038;cht=p3&#038;chdl=Firefox%20(12)|Internet%20Explorer%20(2)|LG%20(1)|Safari%20(1)" alt="API Google Analytics - Graphique des navigateurs du jour 2" width="400" height="150" /></p><p
style="text-align: justify;"></p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Résultat très honorable pour la très faible complexité de ce code. J&#8217;ai donc mon graphique des navigateurs sur la journée. Le nombre entre parenthèses correspond au nombre de visites avec le dit navigateur.</p><p
style="text-align: justify;"></p><h3 style="text-align: justify;">Statistiques par page</h3><p
style="text-align: justify;">Je voulais pouvoir voir mes statistiques par page, en administrateur seulement. C&#8217;est-à-dire avoir à côté de mes liens d&#8217;édition et pour chaque article, le nombre de fois que mon article a été vu aujourd&#8217;hui et combien il y a eu de visites uniques.</p><p
style="text-align: justify;">C&#8217;est maintenant chose faite, et c&#8217;est facile !</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">&lt;?php</span><br
/> <br
/> <span
style="color: #000088;">$email</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'********@********'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$passwd</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'********'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'********'</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #0000ff;">&quot;https://www.google.com/accounts/ClientLogin&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$data</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;">'accountType'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'GOOGLE'</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'Email'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$email</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'Passwd'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$passwd</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'source'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'CLI_GAnalytics'</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'service'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'analytics'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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;">$data</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;Auth=&quot;</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$auth</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$uri</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$_SERVER</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'REQUEST_URI'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">=</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ch1</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:pageviews&amp;dimensions=ga:pagePath&amp;filters=ga:pagePath%3D%3D&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$uri</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$auth</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HEADER<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$response</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$XML_object</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/simplexml_load_string"><span
style="color: #990000;">simplexml_load_string</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$pv</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> ? <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">:</span> <span
style="color: #cc66cc;">0</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'Vue '</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$pv</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">' fois aujourd\'hui.'</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">J&#8217;ai donc mon résultat de la forme :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Vue <span
style="color: #cc66cc;">10</span> fois aujourd<span
style="color: #0000ff;">'hui.</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Ce qu&#8217;il fallait faire pour récupérer les informations de la page courante et ce qui fait l&#8217;intérêt de l&#8217;article :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$ch1</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:pageviews&amp;dimensions=ga:pagePath&amp;filters=ga:pagePath%3D%3D&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$uri</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></div><p
style="text-align: justify;">Ou plus exactement ajouter la <em>dimension </em><strong>pagePath</strong> et filtrer sur cette <em>dimension</em> comme ceci :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #339933;">&amp;</span>filters<span
style="color: #339933;">=</span>ga<span
style="color: #339933;">:</span>pagePath<span
style="color: #339933;">%</span>3D<span
style="color: #339933;">%</span>3D<span
style="color: #0000ff;">&quot; . <span
style="color: #006699; font-weight: bold;">$uri</span> . &quot;</span></div></div><p
style="text-align: justify;">L&#8217;URI de la page se récupère avec :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$_SERVER</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'REQUEST_URI'</span><span
style="color: #009900;">&#93;</span></div></div><p
style="text-align: justify;">On récupère par exemple :<em> /index.html</em>.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Pour avoir la même chose avec les visites uniques, il suffit de modifier le <em>metrics </em>en <strong>uniquepageviews</strong>.</p><p
style="text-align: justify;">L&#8217;utilisation des filtres c&#8217;est par <a
title="Filtres avec l'API Google Analytics" href="http://code.google.com/intl/fr/apis/analytics/docs/gdata/gdataReference.html#filtering">ici</a>. Tous les metrics et dimensions sont par <a
title="Dimensions &#038; Metrics Google Analytics" href="http://code.google.com/intl/fr/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html">là</a>.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Voilà pour ce petit article, on peut faire des choses très puissantes, très simplement, on peut imaginer améliorer son référencement automatiquement en récupérant les infos Google Analytics et en agissant en fonction, cela en toute transparence pour le visiteur comme pour l&#8217;utilisateur.</p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/' title='API Google Analytics – Une classe PHP5 et des résultats d’intégration'>API Google Analytics – Une classe PHP5 et des résultats d’intégration</a></li><li><a
href='http://www.willdurand.fr/seo-google-mythes-et-realites-dhier-et-daujourdhui/' title='SEO Google : Mythes et réalités d’hier et d’aujourd’hui Referencement   Google   SEO   Guide'>SEO Google : Mythes et réalités d’hier et d’aujourd’hui Referencement   Google   SEO   Guide</a></li><li><a
href='http://www.willdurand.fr/decouverte-des-webservices-en-php/' title='Découverte des WebServices en PHP'>Découverte des WebServices en PHP</a></li><li><a
href='http://www.willdurand.fr/etre-notifie-du-passage-de-google-sur-son-site/' title='Etre notifié du passage de Google sur son site'>Etre notifié du passage de Google sur son site</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;bodytext=Apr%C3%A8s%20mes%20premiers%20essais%20d%27hier%2C%20et%20mes%20id%C3%A9es%20d%27impl%C3%A9mentation%20dans%20mon%20syst%C3%A8me%20de%20blog%2C%20je%20me%20suis%20mis%20%C3%A0%20l%27oeuvre.%20J%27ai%20donc%20ajout%C3%A9%20un%20rendu%20au%20code%20d%27hier%20%28avec%20la%20librairie%20graphique%20de%20Google%20ici%29%20et%20mis%20en%20place%20pour%20chacun%20de%20mes%20article" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;notes=Apr%C3%A8s%20mes%20premiers%20essais%20d%27hier%2C%20et%20mes%20id%C3%A9es%20d%27impl%C3%A9mentation%20dans%20mon%20syst%C3%A8me%20de%20blog%2C%20je%20me%20suis%20mis%20%C3%A0%20l%27oeuvre.%20J%27ai%20donc%20ajout%C3%A9%20un%20rendu%20au%20code%20d%27hier%20%28avec%20la%20librairie%20graphique%20de%20Google%20ici%29%20et%20mis%20en%20place%20pour%20chacun%20de%20mes%20article" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;t=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;annotation=Apr%C3%A8s%20mes%20premiers%20essais%20d%27hier%2C%20et%20mes%20id%C3%A9es%20d%27impl%C3%A9mentation%20dans%20mon%20syst%C3%A8me%20de%20blog%2C%20je%20me%20suis%20mis%20%C3%A0%20l%27oeuvre.%20J%27ai%20donc%20ajout%C3%A9%20un%20rendu%20au%20code%20d%27hier%20%28avec%20la%20librairie%20graphique%20de%20Google%20ici%29%20et%20mis%20en%20place%20pour%20chacun%20de%20mes%20article" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Apr%C3%A8s%20mes%20premiers%20essais%20d%27hier%2C%20et%20mes%20id%C3%A9es%20d%27impl%C3%A9mentation%20dans%20mon%20syst%C3%A8me%20de%20blog%2C%20je%20me%20suis%20mis%20%C3%A0%20l%27oeuvre.%20J%27ai%20donc%20ajout%C3%A9%20un%20rendu%20au%20code%20d%27hier%20%28avec%20la%20librairie%20graphique%20de%20Google%20ici%29%20et%20mis%20en%20place%20pour%20chacun%20de%20mes%20article" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;t=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;body=Apr%C3%A8s%20mes%20premiers%20essais%20d%27hier%2C%20et%20mes%20id%C3%A9es%20d%27impl%C3%A9mentation%20dans%20mon%20syst%C3%A8me%20de%20blog%2C%20je%20me%20suis%20mis%20%C3%A0%20l%27oeuvre.%20J%27ai%20donc%20ajout%C3%A9%20un%20rendu%20au%20code%20d%27hier%20%28avec%20la%20librairie%20graphique%20de%20Google%20ici%29%20et%20mis%20en%20place%20pour%20chacun%20de%20mes%20article" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&title=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-round-2-graphiques-et-statistiques-par-page%2F&amp;submitHeadline=API%20Google%20Analytics%20Round%202%20%E2%80%93%20Graphiques%20et%20statistiques%20par%20page&amp;submitSummary=Apr%C3%A8s%20mes%20premiers%20essais%20d%27hier%2C%20et%20mes%20id%C3%A9es%20d%27impl%C3%A9mentation%20dans%20mon%20syst%C3%A8me%20de%20blog%2C%20je%20me%20suis%20mis%20%C3%A0%20l%27oeuvre.%20J%27ai%20donc%20ajout%C3%A9%20un%20rendu%20au%20code%20d%27hier%20%28avec%20la%20librairie%20graphique%20de%20Google%20ici%29%20et%20mis%20en%20place%20pour%20chacun%20de%20mes%20article&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>API Google Analytics, découverte par l’exemple</title><link>http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=api-google-analytics-decouverte-par-lexemple</link> <comments>http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/#comments</comments> <pubDate>Wed, 22 Apr 2009 22:19:10 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[API]]></category> <category><![CDATA[Curl]]></category> <category><![CDATA[Google Analytics]]></category> <category><![CDATA[PHP 5]]></category> <category><![CDATA[Référencement]]></category> <category><![CDATA[Script]]></category> <category><![CDATA[SEO]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[Aujourd&#8217;hui Google a mis au jour sa nouvelle API, il s&#8217;agit de l&#8217;API Google Analytics tant attendue. L&#8217;annonce officielle se trouve ici. J&#8217;ai donc sauté sur l&#8217;occasion pour pondre quelques petits scripts PHP et pouvoir par la suite intégrée Google Analytics à mon système de blog. Cette API est utilisable en JavaScript, PHP, ou encore Java. [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: center;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/google-analytics.jpg" rel="lightbox[31]" title="google-analytics"><img
class="size-full wp-image-212 aligncenter" title="google-analytics" src="http://www.willdurand.fr/wp-content/uploads/2010/07/google-analytics.jpg" alt="" width="180" height="130" /></a></p><p
style="text-align: justify;">Aujourd&#8217;hui Google a mis au jour sa nouvelle API, il s&#8217;agit de l&#8217;API Google Analytics tant attendue. L&#8217;annonce officielle se trouve <a
title="API Google Analytics" href="http://analytics.blogspot.com/2009/04/attention-developers-google-analytics.html">ici</a>. J&#8217;ai donc sauté sur l&#8217;occasion pour pondre quelques petits scripts PHP et pouvoir par la suite intégrée Google Analytics à mon système de blog.</p><p
style="text-align: justify;">Cette API est utilisable en JavaScript, PHP, ou encore Java. En PHP, on peut utiliser cette API avec Zend (<a
title="Exemple Zend" href="http://analyseweb.fr/google-analytics/petit-exemple-d%27implementation-de-l%27api/">ici</a>) ou avec Curl. C&#8217;est ce dernier que j&#8217;ai utilisé dans ce qui suit.</p><h3 style="text-align: justify;">I &#8211; Authentification</h3><p
style="text-align: justify;">Il faut être authentifié pour utiliser cette API, Google offre, comme pour ses autres services, plusieurs possibilités. Je passerais les explications lourdes sur les différents modes d&#8217;authentification (<a
title="Google Data APIs Authentication Overview" href="http://code.google.com/intl/fr/apis/gdata/auth.html">lire ici</a>). Ce qu&#8217;il faut au final, c&#8217;est récupéré un <strong>Token</strong> qui permettra d&#8217;utiliser le service Google Analytics par la suite.</p><p
style="text-align: justify;">Je voulais un système d&#8217;authentification où l&#8217;on ai juste à renseigner ses identifiants Google.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$email</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'*********@*********'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$passwd</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'********'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'********'</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$ch</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #0000ff;">&quot;https://www.google.com/accounts/ClientLogin&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_FOLLOWLOCATION<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$data</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;">'accountType'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'GOOGLE'</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'Email'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$email</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'Passwd'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #000088;">$passwd</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'source'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'CLI_GAnalytics'</span><span
style="color: #339933;">,</span><br
/> <span
style="color: #0000ff;">'service'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #0000ff;">'analytics'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><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;">$data</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$hasil</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;Auth=&quot;</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$auth</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$hasil</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></div><p
style="text-align: justify;">Donc j&#8217;ai utilisé <a
title="Curl PHP" href="http://fr.php.net/curl">Curl</a>, ce qui a nécessité l&#8217;activation du module PHP (dans WAMP).</p><p
style="text-align: justify;"><strong>$ids</strong> représente l&#8217;identifiant du site concerné. Il est à récupérer dans Google Analytics, il suffit d&#8217;ouvrir le dashboard du site et de regarder l&#8217;identifiant dans l&#8217;url qui se présente ainsi : <em>https://www.google.com/analytics/reporting/?id=xxxxxxxxx</em>.</p><p
style="text-align: justify;">On passe ensuite les données dans un tableau, en sachant que vous pouvez mettre ce que vous voulez dans <em>&#8216;source&#8217;</em>.</p><p
style="text-align: justify;"><strong>$auth</strong> est mon Token d&#8217;authentification auprès du service Google Analytics.</p><p
style="text-align: justify;"></p><h3 style="text-align: justify;">II &#8211; Récupération des informations</h3><p
style="text-align: justify;">Je désire afficher, pour le jour courant (oui parce que l&#8217;API permet de récupérer les informations de  son site en direct), le nombre de visites par navigateur.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">=</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;">'Y-m-d'</span><span
style="color: #339933;">,</span> <a
href="http://www.php.net/time"><span
style="color: #990000;">time</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ch1</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_init"><span
style="color: #990000;">curl_init</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;https://www.google.com/analytics/feeds/data?ids=ga:&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$ids</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;metrics=ga:visits&amp;dimensions=ga:browser&amp;start-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">&quot;&amp;end-date=&quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$current_date</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$auth</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_SSL_VERIFYPEER<span
style="color: #339933;">,</span> <span
style="color: #cc66cc;">0</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">true</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HEADER<span
style="color: #339933;">,</span> <span
style="color: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$response</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/curl_exec"><span
style="color: #990000;">curl_exec</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_close"><span
style="color: #990000;">curl_close</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$XML_object</span> <span
style="color: #339933;">=</span> <a
href="http://www.php.net/simplexml_load_string"><span
style="color: #990000;">simplexml_load_string</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;ul&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">foreach</span><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span> <span
style="color: #b1b100;">as</span> <span
style="color: #000088;">$m</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #000088;">$tmp</span> <span
style="color: #339933;">=</span> <span
style="color: #339933;">@</span><a
href="http://www.php.net/split"><span
style="color: #990000;">split</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'ga:browser='</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">title</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;li&gt;'</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$tmp</span><span
style="color: #009900;">&#91;</span><span
style="color: #cc66cc;">1</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">' : '</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$m</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">' visits&lt;/li&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;/ul&gt;'</span><span
style="color: #339933;">;</span></div></div><p
style="text-align: justify;">Lorsqu&#8217;on veut utiliser l&#8217;API il faut indiquer que l&#8217;on est authentifié, c&#8217;est le but des lignes :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$header</span><span
style="color: #009900;">&#91;</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'Authorization: GoogleLogin auth='</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$auth</span><span
style="color: #339933;">;</span><br
/> <a
href="http://www.php.net/curl_setopt"><span
style="color: #990000;">curl_setopt</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ch1</span><span
style="color: #339933;">,</span> CURLOPT_HTTPHEADER<span
style="color: #339933;">,</span> <span
style="color: #000088;">$header</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Ensuite, il est obligatoire de renseigner les paramètres <strong>ids</strong>, <strong>start-date</strong> et <strong>end-date</strong>. Sinon on obtient une belle erreur&#8230; Ici, je cherche à récupérer le nombre de visites (qui est le <em>metric</em>) en fonction du navigateur qui est la <em>dimension</em>.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">https<span
style="color: #339933;">:</span><span
style="color: #666666; font-style: italic;">//www.google.com/analytics/feeds/data?ids=ga:&quot; . $ids . &quot;&amp;metrics=ga:visits&amp;dimensions=ga:browser&amp;start-date=&quot; . $current_date . &quot;&amp;end-date=&quot; . $current_date);</span></div></div><p
style="text-align: justify;">Les metrics et dimensions sont disponibles <a
title="Dimensions &#038; Metrics Reference" href="http://code.google.com/intl/fr/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html">ici</a>.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">On récupère un flux XML, que j&#8217;ai d&#8217;abord épuré :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000088;">$XML_response</span> <span
style="color: #339933;">=</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;">'dxp:'</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">''</span><span
style="color: #339933;">,</span><span
style="color: #000088;">$response</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span></div></div><p
style="text-align: justify;">Puis je charge un objet XML pour récupérer les résultats que je souhaite.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Ce code produit le résultat suivant :</p><ul><li
style="text-align: justify;">Chrome : 1 visits</li><li
style="text-align: justify;">Firefox : 15 visits</li><li
style="text-align: justify;">Internet Explorer : 3 visits</li></ul><p
style="text-align: justify;">Youpi ! Je suis riche, 19 visites aujourd&#8217;hui&#8230;</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Pour récupérer le nombre de visiteurs, il suffit de modifier les <em>metrics </em>et <em>dimensions </em>:</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">https<span
style="color: #339933;">:</span><span
style="color: #666666; font-style: italic;">//www.google.com/analytics/feeds/data?ids=ga:&quot; . $ids . &quot;&amp;metrics=ga:visits&amp;start-date=&quot; . $current_date . &quot;&amp;end-date=&quot; . $current_date);</span></div></div><p
style="text-align: justify;">et de changer l&#8217;accès au résultat :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$XML_object</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">entry</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">metric</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'value'</span><span
style="color: #009900;">&#93;</span> <span
style="color: #339933;">.</span> <span
style="color: #0000ff;">' visits'</span><span
style="color: #339933;">;</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Pour récupérer le nombre de pages vues, on modifie comme ceci (l&#8217;accès au résultat est le même) :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">https<span
style="color: #339933;">:</span><span
style="color: #666666; font-style: italic;">//www.google.com/analytics/feeds/data?ids=ga:&quot; . $ids . &quot;&amp;metrics=ga:pageviews&amp;start-date=&quot; . $current_date . &quot;&amp;end-date=&quot; . $current_date);</span></div></div><p
style="text-align: justify;"></p><h3 style="text-align: justify;">III &#8211; Le mot de la fin</h3><p
style="text-align: justify;">Cette API est très intéressante et très simple à mettre en oeuvre. La documentation est claire et il y en a beaucoup.</p><p
style="text-align: justify;">Pour la suite, il peut être intéressant d&#8217;avoir ce genre de statistiques dans l&#8217;administration de son site ou de naviguer en administrateur et de pouvoir voir sur chacun de ses articles de telles statistiques.</p><p
style="text-align: justify;">Pour moi, ce sera cette dernière idée qui sera mise en place <img
style="border: 0px none;" src="http://www.willdurand.fr/js/fckeditor/editor/images/smiley/msn/regular_smile.gif" alt="" />.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"><em><strong>Sources :</strong></em> http://google-data-api.blogspot.com/2008/05/clientlogin-with-php-curl.html <strong>pour l&#8217;utilisation de Curl, et l&#8217;API Google pour le reste.</strong></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/' title='API Google Analytics – Une classe PHP5 et des résultats d’intégration'>API Google Analytics – Une classe PHP5 et des résultats d’intégration</a></li><li><a
href='http://www.willdurand.fr/seo-google-mythes-et-realites-dhier-et-daujourdhui/' title='SEO Google : Mythes et réalités d’hier et d’aujourd’hui Referencement   Google   SEO   Guide'>SEO Google : Mythes et réalités d’hier et d’aujourd’hui Referencement   Google   SEO   Guide</a></li><li><a
href='http://www.willdurand.fr/decouverte-des-webservices-en-php/' title='Découverte des WebServices en PHP'>Découverte des WebServices en PHP</a></li><li><a
href='http://www.willdurand.fr/etre-notifie-du-passage-de-google-sur-son-site/' title='Etre notifié du passage de Google sur son site'>Etre notifié du passage de Google sur son site</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;bodytext=%0D%0AAujourd%27hui%20Google%20a%20mis%20au%20jour%20sa%20nouvelle%20API%2C%20il%20s%27agit%20de%20l%27API%20Google%20Analytics%20tant%20attendue.%20L%27annonce%20officielle%20se%20trouve%20ici.%20J%27ai%20donc%20saut%C3%A9%20sur%20l%27occasion%20pour%20pondre%20quelques%20petits%20scripts%20PHP%20et%20pouvoir%20par%20la%20suite%20int%C3%A9gr%C3%A9e%20Goog" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;notes=%0D%0AAujourd%27hui%20Google%20a%20mis%20au%20jour%20sa%20nouvelle%20API%2C%20il%20s%27agit%20de%20l%27API%20Google%20Analytics%20tant%20attendue.%20L%27annonce%20officielle%20se%20trouve%20ici.%20J%27ai%20donc%20saut%C3%A9%20sur%20l%27occasion%20pour%20pondre%20quelques%20petits%20scripts%20PHP%20et%20pouvoir%20par%20la%20suite%20int%C3%A9gr%C3%A9e%20Goog" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;t=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;annotation=%0D%0AAujourd%27hui%20Google%20a%20mis%20au%20jour%20sa%20nouvelle%20API%2C%20il%20s%27agit%20de%20l%27API%20Google%20Analytics%20tant%20attendue.%20L%27annonce%20officielle%20se%20trouve%20ici.%20J%27ai%20donc%20saut%C3%A9%20sur%20l%27occasion%20pour%20pondre%20quelques%20petits%20scripts%20PHP%20et%20pouvoir%20par%20la%20suite%20int%C3%A9gr%C3%A9e%20Goog" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=%0D%0AAujourd%27hui%20Google%20a%20mis%20au%20jour%20sa%20nouvelle%20API%2C%20il%20s%27agit%20de%20l%27API%20Google%20Analytics%20tant%20attendue.%20L%27annonce%20officielle%20se%20trouve%20ici.%20J%27ai%20donc%20saut%C3%A9%20sur%20l%27occasion%20pour%20pondre%20quelques%20petits%20scripts%20PHP%20et%20pouvoir%20par%20la%20suite%20int%C3%A9gr%C3%A9e%20Goog" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;t=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;body=%0D%0AAujourd%27hui%20Google%20a%20mis%20au%20jour%20sa%20nouvelle%20API%2C%20il%20s%27agit%20de%20l%27API%20Google%20Analytics%20tant%20attendue.%20L%27annonce%20officielle%20se%20trouve%20ici.%20J%27ai%20donc%20saut%C3%A9%20sur%20l%27occasion%20pour%20pondre%20quelques%20petits%20scripts%20PHP%20et%20pouvoir%20par%20la%20suite%20int%C3%A9gr%C3%A9e%20Goog" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&title=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fapi-google-analytics-decouverte-par-lexemple%2F&amp;submitHeadline=API%20Google%20Analytics%2C%20d%C3%A9couverte%20par%20l%E2%80%99exemple&amp;submitSummary=%0D%0AAujourd%27hui%20Google%20a%20mis%20au%20jour%20sa%20nouvelle%20API%2C%20il%20s%27agit%20de%20l%27API%20Google%20Analytics%20tant%20attendue.%20L%27annonce%20officielle%20se%20trouve%20ici.%20J%27ai%20donc%20saut%C3%A9%20sur%20l%27occasion%20pour%20pondre%20quelques%20petits%20scripts%20PHP%20et%20pouvoir%20par%20la%20suite%20int%C3%A9gr%C3%A9e%20Goog&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Découverte des WebServices en PHP</title><link>http://www.willdurand.fr/decouverte-des-webservices-en-php/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=decouverte-des-webservices-en-php</link> <comments>http://www.willdurand.fr/decouverte-des-webservices-en-php/#comments</comments> <pubDate>Thu, 16 Apr 2009 17:57:29 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[How to]]></category> <category><![CDATA[PHP 5]]></category> <category><![CDATA[Script]]></category> <category><![CDATA[WebService]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[Et oui, en PHP on peut faire des webservices. Mais un WebService c&#8217;est quoi d&#8217;abord ? C&#8217;est un programme sur Internet qui permet la communication et l&#8217;échange de données entre applications. Ce sont des fonctionnalités, des services mis à disposition sur Internet (ou Intranet) et accessibles par tout le monde. C&#8217;est interopérable, c&#8217;est basé sur HTTP [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Et oui, en PHP on peut faire des webservices. Mais un WebService c&#8217;est quoi d&#8217;abord ?</p><p
style="text-align: justify;">C&#8217;est un programme sur Internet qui permet la communication et l&#8217;échange de données entre applications. Ce sont des fonctionnalités, des services mis à disposition sur Internet (ou Intranet) et accessibles par tout le monde.</p><p
style="text-align: justify;">C&#8217;est interopérable, c&#8217;est basé sur HTTP (donc pas de soucis au niveau des parefeux), on utilise des standards et des protocoles ouverts, et c&#8217;est l&#8217;avenir du web. Bref, puissant <img
style="border: 0pt none;" src="http://www.willdurand.fr/js/fckeditor/editor/images/smiley/msn/teeth_smile.gif" alt="" /> !</p><p
style="text-align: justify;"></p><h1 style="text-align: justify;">Principe de fonctionnement</h1><p
style="text-align: center;"><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/concepts_ws_interaction.png" rel="lightbox[28]" title="concepts_ws_interaction"><img
class="size-full wp-image-203 aligncenter" title="concepts_ws_interaction" src="http://www.willdurand.fr/wp-content/uploads/2010/07/concepts_ws_interaction.png" alt="" width="400" height="368" /></a></p><p
style="text-align: justify;">Dans l&#8217;exemple illustré, le <em>Client </em>veut savoir le temps qu&#8217;il fait.</p><p
style="text-align: justify;">- En 1, Il va demandé à un annuaire de webservices (UDDI) où il peut trouver un tel service.</p><p
style="text-align: justify;">- En 2, l&#8217;annuaire lui indique où est le service qui pourra le renseigner.</p><p
style="text-align: justify;">- En 3, le client demande au service comment l&#8217;invoquer (c&#8217;est-à-dire comment bien lui demander un service).</p><p
style="text-align: justify;">- En 4, le service renvoit sa déscription (WSDL) où est indiqué comment invoquer ce service.</p><p
style="text-align: justify;">- En 5, le client invoque le service en envoyant une requête SOAP.</p><p
style="text-align: justify;">- En 6, le service renvoit la réponse au client dans une réponse (toujours en SOAP).</p><p
style="text-align: justify;"></p><h1 style="text-align: justify;">Un service web en PHP</h1><p
style="text-align: justify;">En PHP, on peut faire des webservices, que ce soit en tant que client ou en tant que serveur comme je vais expliquer dans ce qui suit. Il faudra préalablement avoir le module <em>php_soap</em> installé et activé.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Mon webservice sera simple, il disposera de deux méthodes :</p><p
style="text-align: justify;">- La première se nommera <em>hello()</em> et retournera &laquo;&nbsp;Hello world!&nbsp;&raquo;.</p><p
style="text-align: justify;">- La deuxième s&#8217;appellera <em>donne()</em>, prendra une variable en attribut et la retournera.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">class</span> Donne<br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">function</span> donne<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$i</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">return</span> <span
style="color: #000088;">$i</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> &nbsp; <span
style="color: #000000; font-weight: bold;">function</span> hello<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><br
/> &nbsp; <span
style="color: #009900;">&#123;</span><br
/> &nbsp; &nbsp; <span
style="color: #b1b100;">return</span> <span
style="color: #0000ff;">&quot;hello world&quot;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span></div></div><p
style="text-align: justify;">La classe ci-dessus représente les fonctionnalités de mon webservice. Il s&#8217;agit maintenant de le mettre en place, c&#8217;est que fait le code ci-après :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">try<br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #000088;">$server</span> <span
style="color: #339933;">=</span> <span
style="color: #000000; font-weight: bold;">new</span> SoapServer<span
style="color: #009900;">&#40;</span><span
style="color: #009900; font-weight: bold;">null</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;">'uri'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'http://monserveur/ws/mon_premier_webservice.php'</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; <span
style="color: #000088;">$server</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">setClass</span><span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">&quot;Donne&quot;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #000088;">$server</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">handle</span><span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> catch<span
style="color: #009900;">&#40;</span>Exception <span
style="color: #000088;">$e</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">&quot;Exception: &quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$e</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span></div></div><p
style="text-align: justify;">On commence par créer un objet <a
href="http://www.manuelphp.com/php/function.soap-soapserver-construct.php"><strong>SoapServer</strong></a> qui prend en arguments un fichier WSDL (<em>null </em>ici) et une liste de paramètres. Si le fichier <em>WSDL </em>n&#8217;est pas renseigné comme ici, il faut obligatoirement spécifier le paramètre <em>URI </em>ensuite.</p><p
style="text-align: justify;">Ensuite, on va indiquer à notre serveur, la classe qui gère les requêtes SOAP par la méthode <em>setClass()</em>. La méthode <em>handle()</em> fait le nécessaire pour gérer une requête SOAP.</p><p
style="text-align: justify;">Voilà c&#8217;est tout, pour être disponible, il faut placer notre service à l&#8217;adresse : <em>http://monserveur/ws/mon_premier_webservice.php.</em></p><p
style="text-align: justify;">L&#8217;<em>URI</em> qui représente l&#8217;espace de nom, est différente de la <em>Location </em>du service qui est l&#8217;URL à interroger.</p><p
style="text-align: justify;"></p><h1 style="text-align: justify;">Un client pour mon premier webservice</h1><p
style="text-align: justify;">L&#8217;utilité d&#8217;un webservice, c&#8217;est de pouvoir l&#8217;exploiter. On va donc développer un petit client en PHP pour invoquer notre service web précédemment écrit.</p><p
style="text-align: justify;">Voici le code de notre petit client :</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">&lt;?php</span><br
/> <br
/> try<br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #000088;">$clientSOAP</span> <span
style="color: #339933;">=</span> <span
style="color: #000000; font-weight: bold;">new</span> SoapClient<span
style="color: #009900;">&#40;</span> <span
style="color: #009900; font-weight: bold;">null</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; <a
href="http://www.php.net/array"><span
style="color: #990000;">array</span></a> <span
style="color: #009900;">&#40;</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'uri'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'http://monserveur/ws/mon_premier_webservice.php'</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'location'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #0000ff;">'http://monserveur/ws/mon_premier_webservice.php'</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'trace'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #cc66cc;">1</span><span
style="color: #339933;">,</span><br
/> &nbsp; &nbsp; &nbsp; <span
style="color: #0000ff;">'exceptions'</span> <span
style="color: #339933;">=&gt;</span> <span
style="color: #cc66cc;">0</span><br
/> &nbsp; <span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; <span
style="color: #000088;">$ret</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$clientSOAP</span><span
style="color: #339933;">-&gt;</span>__call<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'hello'</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: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$ret</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;br /&gt;'</span><span
style="color: #339933;">;</span><br
/> <br
/> &nbsp; <span
style="color: #000088;">$ret</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$clientSOAP</span><span
style="color: #339933;">-&gt;</span>__call<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'donne'</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;">'i'</span><span
style="color: #339933;">=&gt;</span><span
style="color: #cc66cc;">5</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$ret</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> catch<span
style="color: #009900;">&#40;</span>SoapFault <span
style="color: #000088;">$f</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$f</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p
style="text-align: justify;">Ce code teste les deux méthodes de notre service. On crée cette fois-ci un <a
href="http://www.manuelphp.com/php/function.soap-soapclient-construct.php"><strong>SoapClient</strong></a>.</p><p
style="text-align: justify;">On travaille toujours en mode non WSDL, il faut passer obligatoirement deux paramètres qui sont <em>URI </em>et <em>Location</em>. <em>Trace </em>et <em>Exception </em>sont utiles lorsqu&#8217;un problème survient.</p><p
style="text-align: justify;">Pour appeler une méthode, on utilise la méthode <em>__call()</em>. Pour passer les paramètres à une fonction, il suffit de passer un tableau associatif.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Et voilà, ce n&#8217;est finalement pas si compliqué !</p><p
style="text-align: justify;"></p><h1 style="text-align: justify;">Un client plus élaboré pour un service Whois</h1><p
style="text-align: justify;">Pour étoffer cet article, voici un exemple d&#8217;utilisation des webservices. Sur le site <a
href="http://www.xmethods.net/">http://www.xmethods.net/</a> qui présente des services web, j&#8217;ai choisi un service Whois. Le site donne le lien de la description WSDL du service web. C&#8217;est tout ce dont nous avons besoin.</p><p
style="text-align: justify;">Présentation du web service :</p><p
style="text-align: justify; margin-left: 80px;"><span
style="font-family: Times New Roman;"><span
style="color: #333333;">Whois service lets users get domain information from any registry.</span></span></p><p
style="text-align: justify;">Servername is the whois server to be used.Some commonly queried whois servers are:- whois.networksolutions.com- whois.35.com- whois.tucows.com</p><p
style="text-align: justify;">Port is always 43 for whois servers.Domain is the domain name that you want to query.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">La description WSDL de notre service Whois est disponible ici : <a
href="http://www.ecubicle.net/whois_service.asmx?WSDL">http://www.ecubicle.net/whois_service.asmx?WSDL</a>, voici ce que l&#8217;on récupère :</p><div
class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;?xml <span
style="color: #000066;">version</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1.0&quot;</span> encoding<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;utf-8&quot;</span>?&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:definitions xmlns:soap<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot;</span> xmlns:tm<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://microsoft.com/wsdl/mime/textMatching/&quot;</span> xmlns:soapenc<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;</span> xmlns:mime<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/mime/&quot;</span> xmlns:tns<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/&quot;</span> xmlns:s<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema&quot;</span> xmlns:soap12<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/soap12/&quot;</span> xmlns:http<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/http/&quot;</span> targetNamespace<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/&quot;</span> xmlns:wsdl<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:types&gt;</span><br
/> <span
style="color: #009900;">&lt;s:schema elementFormDefault<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;qualified&quot;</span> targetNamespace<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:complexType <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:element&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldResponse&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;s:sequence&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldResult&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:element&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;servername&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;port&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:unsignedByte&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;domain&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:element&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisResponse&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisResult&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:sequence&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:element&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;string&quot;</span> nillable<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;true&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:schema&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:types&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldSoapIn&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;parameters&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorld&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldSoapOut&quot;</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;parameters&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldResponse&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisSoapIn&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;parameters&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:Whois&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisSoapOut&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;parameters&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisResponse&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldHttpGetIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldHttpGetOut&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisHttpGetIn&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;servername&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;port&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;domain&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisHttpGetOut&quot;</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldHttpPostIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorldHttpPostOut&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisHttpPostIn&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;servername&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;port&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;domain&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:message <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisHttpPostOut&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:part <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> element<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:message&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:portType <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceSoap&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldSoapIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldSoapOut&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:documentation xmlns:wsdl<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/&quot;</span>&gt;</span>Whois service lets users get domain information from any registry. <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span> Servername<span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;</span> is the whois server to be used.<span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;</span>Some commonly queried whois servers are: <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>ul<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.networksolutions.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.35.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.tucows.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/ul<span
style="color: #ddbb00;">&amp;gt;</span> <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span> Port <span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;</span>is always 43 for whois servers. <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span>Domain <span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;</span>is the domain name that you want to query.<span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:documentation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:input message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisSoapIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisSoapOut&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:portType&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:portType <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceHttpGet&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldHttpGetIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldHttpGetOut&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:documentation xmlns:wsdl<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/&quot;</span>&gt;</span>Whois service lets users get domain information from any registry. <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span> Servername<span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;</span> is the whois server to be used.<span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;</span>Some commonly queried whois servers are: <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>ul<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.networksolutions.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.35.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.tucows.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/ul<span
style="color: #ddbb00;">&amp;gt;</span> <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span> Port <span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;</span>is always 43 for whois servers. <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span>Domain <span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;</span>is the domain name that you want to query.<span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:documentation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:input message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisHttpGetIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisHttpGetOut&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:portType&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:portType <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceHttpPost&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldHttpPostIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:HelloWorldHttpPostOut&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:documentation xmlns:wsdl<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/wsdl/&quot;</span>&gt;</span>Whois service lets users get domain information from any registry. <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span> Servername<span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;</span> is the whois server to be used.<span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;</span>Some commonly queried whois servers are: <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>ul<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.networksolutions.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.35.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>li<span
style="color: #ddbb00;">&amp;gt;</span>whois.tucows.com<span
style="color: #ddbb00;">&amp;lt;</span>/li<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>/ul<span
style="color: #ddbb00;">&amp;gt;</span> <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span> Port <span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;</span>is always 43 for whois servers. <span
style="color: #ddbb00;">&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>h4<span
style="color: #ddbb00;">&amp;gt;</span>Domain <span
style="color: #ddbb00;">&amp;lt;</span>/h4<span
style="color: #ddbb00;">&amp;gt;&amp;lt;</span>br/<span
style="color: #ddbb00;">&amp;gt;</span>is the domain name that you want to query.<span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:documentation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:input message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisHttpPostIn&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output message<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:WhoisHttpPostOut&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:portType&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:binding <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceSoap&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceSoap&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap:binding transport<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/soap/http&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap:operation soapAction<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/HelloWorld&quot;</span> <span
style="color: #000066;">style</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;document&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;soap:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;soap:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap:operation soapAction<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/Whois&quot;</span> <span
style="color: #000066;">style</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;document&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;soap:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;soap:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:binding&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:binding <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceSoap12&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceSoap&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:binding transport<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://schemas.xmlsoap.org/soap/http&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:operation soapAction<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/HelloWorld&quot;</span> <span
style="color: #000066;">style</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;document&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:operation soapAction<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/webservices/Whois&quot;</span> <span
style="color: #000066;">style</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;document&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:body use<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;literal&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:binding&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:binding <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceHttpGet&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceHttpGet&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:binding verb<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;GET&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:operation location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;/HelloWorld&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;http:urlEncoded <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;mime:mimeXml part<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:operation location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;/Whois&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;http:urlEncoded <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;mime:mimeXml part<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:binding&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:binding <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceHttpPost&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceHttpPost&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:binding verb<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;POST&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;HelloWorld&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:operation location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;/HelloWorld&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;mime:<span
style="color: #000066;">content</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;application/x-www-form-urlencoded&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;mime:mimeXml part<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:operation <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:operation location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;/Whois&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:input&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;mime:<span
style="color: #000066;">content</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;application/x-www-form-urlencoded&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:input&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;mime:mimeXml part<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Body&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:output&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:operation&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:binding&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:service <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_service&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:port <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceSoap&quot;</span> binding<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceSoap&quot;</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;soap:address location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/whois_service.asmx&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:port&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:port <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceSoap12&quot;</span> binding<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceSoap12&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;soap12:address location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/whois_service.asmx&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:port&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:port <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceHttpGet&quot;</span> binding<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceHttpGet&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;http:address location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/whois_service.asmx&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:port&gt;</span><br
/> <span
style="color: #009900;">&lt;wsdl:port <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;whois_serviceHttpPost&quot;</span> binding<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;tns:whois_serviceHttpPost&quot;</span>&gt;</span><br
/> <br
/> <span
style="color: #009900;">&lt;http:address location<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;http://www.ecubicle.net/whois_service.asmx&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:port&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:service&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>wsdl:definitions&gt;</span></div></div><p
style="text-align: justify;">Seul le début nous intéresse. Par exemple, on voit que ce service propose deux fonctionnalités : <em>HelloWorld </em>et <em>Whois</em>.</p><p
style="text-align: justify;">- <em>HelloWorld </em>s&#8217;invoque sans paramètres (décrit par l&#8217;élément <em>HelloWorld</em>), et retourne un <em>HelloWorldResult </em>de type <em>String</em> (décrit par l&#8217;élément <em>HelloWorldResponse</em>).</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #339933;">&lt;</span>s<span
style="color: #339933;">:</span>element name<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;HelloWorld&quot;</span><span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;</span>s<span
style="color: #339933;">:</span>complexType <span
style="color: #339933;">/&gt;</span><br
/> <span
style="color: #339933;">&lt;/</span>s<span
style="color: #339933;">:</span>element<span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;</span>s<span
style="color: #339933;">:</span>element name<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;HelloWorldResponse&quot;</span><span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;</span>s<span
style="color: #339933;">:</span>complexType<span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;</span>s<span
style="color: #339933;">:</span>sequence<span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;</span>s<span
style="color: #339933;">:</span>element minOccurs<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;0&quot;</span> maxOccurs<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;1&quot;</span> name<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;HelloWorldResult&quot;</span> type<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;s:string&quot;</span> <span
style="color: #339933;">/&gt;</span><br
/> <span
style="color: #339933;">&lt;/</span>s<span
style="color: #339933;">:</span>sequence<span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;/</span>s<span
style="color: #339933;">:</span>complexType<span
style="color: #339933;">&gt;</span><br
/> <span
style="color: #339933;">&lt;/</span>s<span
style="color: #339933;">:</span>element<span
style="color: #339933;">&gt;</span></div></div><p
style="text-align: justify;">- <em>Whois </em>s&#8217;invoque en passant un objet et retourne un <em>WhoisResult</em> de type <em>String</em>.</p><p
style="text-align: justify;">L&#8217;objet passé se compose de trois attributs : <strong>servername </strong>de type <em>String</em>, <strong>port </strong>qui est un <em>entier non signé</em>, et <strong>domain </strong>de type <em>String</em>.</p><div
class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;Whois&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;servername&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;port&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:unsignedByte&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;domain&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:element&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisResponse&quot;</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;s:element minOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;0&quot;</span> maxOccurs<span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;1&quot;</span> <span
style="color: #000066;">name</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;WhoisResult&quot;</span> <span
style="color: #000066;">type</span><span
style="color: #66cc66;">=</span><span
style="color: #ff0000;">&quot;s:string&quot;</span> <span
style="color: #66cc66;">/</span>&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:sequence&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:complexType&gt;</span><br
/> <span
style="color: #009900;">&lt;<span
style="color: #66cc66;">/</span>s:element&gt;</span></div></div><p
style="text-align: justify;"></p><p
style="text-align: justify;">Il faudra donc une classe PHP représentant cet objet. Ensuite on va utiliser un SoapClient en mode WSDL. Le script qui suit affiche la liste des fonctionnalités du service grâce à la fonction <em>__getFunctions()</em>, puis invoque successivement les deux méthodes du service.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">&lt;?php</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">class</span> Whois<br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$servername</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$port</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000000; font-weight: bold;">private</span> <span
style="color: #000088;">$domain</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">function</span> __construct<span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$s</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$p</span><span
style="color: #339933;">,</span> <span
style="color: #000088;">$d</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">servername</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$s</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">port</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$p</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$this</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">domain</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$d</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <br
/> try<br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #000088;">$client</span> <span
style="color: #339933;">=</span> <span
style="color: #000000; font-weight: bold;">new</span> SoapClient<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'http://www.ecubicle.net/whois_service.asmx?WSDL'</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/var_dump"><span
style="color: #990000;">var_dump</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$client</span><span
style="color: #339933;">-&gt;</span>__getFunctions<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;hr /&gt;&lt;br /&gt;'</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;b&gt;Invocation de HelloWorld() :&lt;/b&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;br /&gt;'</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #000088;">$ret</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$client</span><span
style="color: #339933;">-&gt;</span>__soapCall<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'HelloWorld'</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: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <a
href="http://www.php.net/print_r"><span
style="color: #990000;">print_r</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$ret</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;br /&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$ret</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">HelloWorldResult</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;br /&gt;&lt;br /&gt;<br
/> &lt;b&gt;Invocation de Whois() :&lt;/b&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;br /&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #000088;">$ret</span> <span
style="color: #339933;">=</span> <span
style="color: #000088;">$client</span><span
style="color: #339933;">-&gt;</span>__soapCall<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'Whois'</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;">'Whois'</span><span
style="color: #339933;">=&gt;</span>new Whois<span
style="color: #009900;">&#40;</span><span
style="color: #0000ff;">'whois.verisign-grs.com'</span><span
style="color: #339933;">,</span><span
style="color: #cc66cc;">43</span><span
style="color: #339933;">,</span><span
style="color: #0000ff;">'google.fr'</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #000088;">$ret</span><span
style="color: #339933;">-&gt;</span><span
style="color: #004000;">WhoisResult</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> catch<span
style="color: #009900;">&#40;</span>Exception <span
style="color: #000088;">$e</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">'&lt;br /&gt;&lt;hr /&gt;'</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #b1b100;">echo</span> <span
style="color: #0000ff;">&quot;&lt;b&gt;Exception:&lt;/b&gt; &quot;</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$e</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span><br
/> <br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/api-google-analytics-une-classe-php5-et-des-resultats-d-integration/' title='API Google Analytics – Une classe PHP5 et des résultats d’intégration'>API Google Analytics – Une classe PHP5 et des résultats d’intégration</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li><li><a
href='http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/' title='Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL'>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</a></li><li><a
href='http://www.willdurand.fr/un-mvc-en-php5-le-flux-d-entree/' title='Un MVC en PHP5 : le flux d’entrée'>Un MVC en PHP5 : le flux d’entrée</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;bodytext=Et%20oui%2C%20en%20PHP%C2%A0on%20peut%20faire%20des%20webservices.%20Mais%20un%20WebService%20c%27est%20quoi%20d%27abord%20%3F%0D%0AC%27est%20un%20programme%20sur%20Internet%20qui%20permet%20la%20communication%20et%20l%27%C3%A9change%20de%20donn%C3%A9es%20entre%20applications.%20Ce%20sont%20des%20fonctionnalit%C3%A9s%2C%20des%20services%20mis%20%C3%A0%20dispos" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;title=D%C3%A9couverte%20des%20WebServices%20en%20PHP" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;notes=Et%20oui%2C%20en%20PHP%C2%A0on%20peut%20faire%20des%20webservices.%20Mais%20un%20WebService%20c%27est%20quoi%20d%27abord%20%3F%0D%0AC%27est%20un%20programme%20sur%20Internet%20qui%20permet%20la%20communication%20et%20l%27%C3%A9change%20de%20donn%C3%A9es%20entre%20applications.%20Ce%20sont%20des%20fonctionnalit%C3%A9s%2C%20des%20services%20mis%20%C3%A0%20dispos" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;t=D%C3%A9couverte%20des%20WebServices%20en%20PHP" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=D%C3%A9couverte%20des%20WebServices%20en%20PHP%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;annotation=Et%20oui%2C%20en%20PHP%C2%A0on%20peut%20faire%20des%20webservices.%20Mais%20un%20WebService%20c%27est%20quoi%20d%27abord%20%3F%0D%0AC%27est%20un%20programme%20sur%20Internet%20qui%20permet%20la%20communication%20et%20l%27%C3%A9change%20de%20donn%C3%A9es%20entre%20applications.%20Ce%20sont%20des%20fonctionnalit%C3%A9s%2C%20des%20services%20mis%20%C3%A0%20dispos" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Et%20oui%2C%20en%20PHP%C2%A0on%20peut%20faire%20des%20webservices.%20Mais%20un%20WebService%20c%27est%20quoi%20d%27abord%20%3F%0D%0AC%27est%20un%20programme%20sur%20Internet%20qui%20permet%20la%20communication%20et%20l%27%C3%A9change%20de%20donn%C3%A9es%20entre%20applications.%20Ce%20sont%20des%20fonctionnalit%C3%A9s%2C%20des%20services%20mis%20%C3%A0%20dispos" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;t=D%C3%A9couverte%20des%20WebServices%20en%20PHP" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;body=Et%20oui%2C%20en%20PHP%C2%A0on%20peut%20faire%20des%20webservices.%20Mais%20un%20WebService%20c%27est%20quoi%20d%27abord%20%3F%0D%0AC%27est%20un%20programme%20sur%20Internet%20qui%20permet%20la%20communication%20et%20l%27%C3%A9change%20de%20donn%C3%A9es%20entre%20applications.%20Ce%20sont%20des%20fonctionnalit%C3%A9s%2C%20des%20services%20mis%20%C3%A0%20dispos" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&title=D%C3%A9couverte%20des%20WebServices%20en%20PHP&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fdecouverte-des-webservices-en-php%2F&amp;submitHeadline=D%C3%A9couverte%20des%20WebServices%20en%20PHP&amp;submitSummary=Et%20oui%2C%20en%20PHP%C2%A0on%20peut%20faire%20des%20webservices.%20Mais%20un%20WebService%20c%27est%20quoi%20d%27abord%20%3F%0D%0AC%27est%20un%20programme%20sur%20Internet%20qui%20permet%20la%20communication%20et%20l%27%C3%A9change%20de%20donn%C3%A9es%20entre%20applications.%20Ce%20sont%20des%20fonctionnalit%C3%A9s%2C%20des%20services%20mis%20%C3%A0%20dispos&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/decouverte-des-webservices-en-php/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Etre notifié du passage de Google sur son site</title><link>http://www.willdurand.fr/etre-notifie-du-passage-de-google-sur-son-site/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=etre-notifie-du-passage-de-google-sur-son-site</link> <comments>http://www.willdurand.fr/etre-notifie-du-passage-de-google-sur-son-site/#comments</comments> <pubDate>Sun, 12 Apr 2009 17:46:53 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[Crawl]]></category> <category><![CDATA[Google Bot]]></category> <category><![CDATA[Notifier]]></category> <category><![CDATA[Référencement]]></category> <category><![CDATA[Script]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[&#60; pre style=&#160;&#187;text-align: center;&#160;&#187;> J'ai récemment mis en ligne mon blog, et le premier soucis pour les gens dans mon cas (outre le fait d'ajouter du contenu) c'est d'être référencé. J'ai donc enregistré mon site auprès de Google. Niveau référencement, j'ai glané le plus d'astuces possibles que j'ai réinjecté dans mon blog et ainsi pouvoir [...]]]></description> <content:encoded><![CDATA[<p>&lt;</p><p>pre style=&nbsp;&raquo;text-align: center;&nbsp;&raquo;><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/google-organic-crawl.gif" rel="lightbox[26]" title="google-organic-crawl"><img
title="google-organic-crawl" src="http://www.willdurand.fr/wp-content/uploads/2010/07/google-organic-crawl.gif" alt="" width="500" height="525" /></a></p><p
style="text-align: justify;">J'ai récemment mis en ligne mon blog, et le premier soucis pour les gens dans mon cas (outre le fait d'ajouter du contenu) c'est d'être référencé. J'ai donc enregistré mon site auprès de Google.</p><p
style="text-align: justify;">Niveau référencement, j'ai glané le plus d'astuces possibles que j'ai réinjecté dans mon blog et ainsi pouvoir être référencé au mieux.</p><p
style="text-align: justify;">Ensuite j'ai enregistré mon site dans <strong>Outils pour les webmasters</strong> by Google, et j'ai attendu... Cela fait plus d'une semaine et très peu d'infos, alors je me suis dit qu'une alerte mail lorsque Google passait sur mon blog, ça pourrait être bien.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Bah voilà le script que j'ai trouvé ici <a
title="Be notified when google crawls your site" href="http://www.protycoon.com/2008/02/19/php-be-notified-when-google-crawls-your-site/">http://www.protycoon.com/2008/02/19/php-be-notified-when-google-crawls-your-site/</a>.</p><div
class="codecolorer-container php vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #b1b100;">if</span><span
style="color: #009900;">&#40;</span><a
href="http://www.php.net/strpos"><span
style="color: #990000;">strpos</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$_SERVER</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'HTTP_USER_AGENT'</span><span
style="color: #009900;">&#93;</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'Googlebot'</span><span
style="color: #009900;">&#41;</span> <span
style="color: #339933;">!==</span> <span
style="color: #009900; font-weight: bold;">false</span><span
style="color: #009900;">&#41;</span><br
/> <span
style="color: #009900;">&#123;</span><br
/> &nbsp; <span
style="color: #000088;">$email_address</span> <span
style="color: #339933;">=</span> <span
style="color: #0000ff;">'webmaster[AT]willdurand.fr'</span><span
style="color: #339933;">;</span><br
/> &nbsp; <a
href="http://www.php.net/mail"><span
style="color: #990000;">mail</span></a><span
style="color: #009900;">&#40;</span><span
style="color: #000088;">$email_address</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'Googlebot Alert'</span><span
style="color: #339933;">,</span> <span
style="color: #0000ff;">'The Googlebot has visited your page: '</span> <span
style="color: #339933;">.</span> <span
style="color: #000088;">$_SERVER</span><span
style="color: #009900;">&#91;</span><span
style="color: #0000ff;">'REQUEST_URI'</span><span
style="color: #009900;">&#93;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #009900;">&#125;</span></div></div><p
style="text-align: justify;">Je reçois un mail dès que le Googlebot passe sur l'une de mes pages. Pratique n'est-ce pas ? <img
class="emoticon" src="http://www.willdurand.fr/js/fckeditor/editor/images/smiley/msn/regular_smile.gif" alt="" /></p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/api-google-analytics-round-2-graphiques-et-statistiques-par-page/' title='API Google Analytics Round 2 – Graphiques et statistiques par page'>API Google Analytics Round 2 – Graphiques et statistiques par page</a></li><li><a
href='http://www.willdurand.fr/api-google-analytics-decouverte-par-lexemple/' title='API Google Analytics, découverte par l’exemple'>API Google Analytics, découverte par l’exemple</a></li><li><a
href='http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/' title='Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL'>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</a></li><li><a
href='http://www.willdurand.fr/gravatar-de-beaux-avatars-dans-les-commentaires/' title='Gravatar : De beaux avatars dans les commentaires'>Gravatar : De beaux avatars dans les commentaires</a></li><li><a
href='http://www.willdurand.fr/seo-google-mythes-et-realites-dhier-et-daujourdhui/' title='SEO Google : Mythes et réalités d’hier et d’aujourd’hui Referencement   Google   SEO   Guide'>SEO Google : Mythes et réalités d’hier et d’aujourd’hui Referencement   Google   SEO   Guide</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;bodytext=%0D%0AJ%27ai%20r%C3%A9cemment%20mis%20en%20ligne%20mon%20blog%2C%20et%20le%20premier%20soucis%20pour%20les%20gens%20dans%20mon%20cas%20%28outre%20le%20fait%20d%27ajouter%20du%20contenu%29%20c%27est%20d%27%C3%AAtre%20r%C3%A9f%C3%A9renc%C3%A9.%20J%27ai%20donc%20enregistr%C3%A9%20mon%20site%20aupr%C3%A8s%20de%20Google.%0D%0ANiveau%20r%C3%A9f%C3%A9rencement%2C%20j%27ai%20glan%C3%A9%20le%20plus%20d" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;notes=%0D%0AJ%27ai%20r%C3%A9cemment%20mis%20en%20ligne%20mon%20blog%2C%20et%20le%20premier%20soucis%20pour%20les%20gens%20dans%20mon%20cas%20%28outre%20le%20fait%20d%27ajouter%20du%20contenu%29%20c%27est%20d%27%C3%AAtre%20r%C3%A9f%C3%A9renc%C3%A9.%20J%27ai%20donc%20enregistr%C3%A9%20mon%20site%20aupr%C3%A8s%20de%20Google.%0D%0ANiveau%20r%C3%A9f%C3%A9rencement%2C%20j%27ai%20glan%C3%A9%20le%20plus%20d" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;t=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;annotation=%0D%0AJ%27ai%20r%C3%A9cemment%20mis%20en%20ligne%20mon%20blog%2C%20et%20le%20premier%20soucis%20pour%20les%20gens%20dans%20mon%20cas%20%28outre%20le%20fait%20d%27ajouter%20du%20contenu%29%20c%27est%20d%27%C3%AAtre%20r%C3%A9f%C3%A9renc%C3%A9.%20J%27ai%20donc%20enregistr%C3%A9%20mon%20site%20aupr%C3%A8s%20de%20Google.%0D%0ANiveau%20r%C3%A9f%C3%A9rencement%2C%20j%27ai%20glan%C3%A9%20le%20plus%20d" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=%0D%0AJ%27ai%20r%C3%A9cemment%20mis%20en%20ligne%20mon%20blog%2C%20et%20le%20premier%20soucis%20pour%20les%20gens%20dans%20mon%20cas%20%28outre%20le%20fait%20d%27ajouter%20du%20contenu%29%20c%27est%20d%27%C3%AAtre%20r%C3%A9f%C3%A9renc%C3%A9.%20J%27ai%20donc%20enregistr%C3%A9%20mon%20site%20aupr%C3%A8s%20de%20Google.%0D%0ANiveau%20r%C3%A9f%C3%A9rencement%2C%20j%27ai%20glan%C3%A9%20le%20plus%20d" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;t=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;body=%0D%0AJ%27ai%20r%C3%A9cemment%20mis%20en%20ligne%20mon%20blog%2C%20et%20le%20premier%20soucis%20pour%20les%20gens%20dans%20mon%20cas%20%28outre%20le%20fait%20d%27ajouter%20du%20contenu%29%20c%27est%20d%27%C3%AAtre%20r%C3%A9f%C3%A9renc%C3%A9.%20J%27ai%20donc%20enregistr%C3%A9%20mon%20site%20aupr%C3%A8s%20de%20Google.%0D%0ANiveau%20r%C3%A9f%C3%A9rencement%2C%20j%27ai%20glan%C3%A9%20le%20plus%20d" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&title=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fetre-notifie-du-passage-de-google-sur-son-site%2F&amp;submitHeadline=Etre%20notifi%C3%A9%20du%20passage%20de%20Google%20sur%20son%20site&amp;submitSummary=%0D%0AJ%27ai%20r%C3%A9cemment%20mis%20en%20ligne%20mon%20blog%2C%20et%20le%20premier%20soucis%20pour%20les%20gens%20dans%20mon%20cas%20%28outre%20le%20fait%20d%27ajouter%20du%20contenu%29%20c%27est%20d%27%C3%AAtre%20r%C3%A9f%C3%A9renc%C3%A9.%20J%27ai%20donc%20enregistr%C3%A9%20mon%20site%20aupr%C3%A8s%20de%20Google.%0D%0ANiveau%20r%C3%A9f%C3%A9rencement%2C%20j%27ai%20glan%C3%A9%20le%20plus%20d&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/etre-notifie-du-passage-de-google-sur-son-site/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 2/34 queries in 0.015 seconds using memcached
Object Caching 2902/2974 objects using memcached

Served from: www.willdurand.fr @ 2012-02-06 08:51:48 -->
