<?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>Script Marketing</title>
	<atom:link href="http://www.scripts-marketing.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scripts-marketing.com</link>
	<description>Tout pour réaliser vos scripts</description>
	<lastBuildDate>Tue, 31 Aug 2010 16:46:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Affichage aléatoire d&#8217;un string.</title>
		<link>http://www.scripts-marketing.com/affichage-aleatoire-dun-string/</link>
		<comments>http://www.scripts-marketing.com/affichage-aleatoire-dun-string/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 16:44:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[Fonctions Utiles En Php]]></category>
		<category><![CDATA[tirage aléatoire]]></category>
		<category><![CDATA[tirage au sort php]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=152</guid>
		<description><![CDATA[Vous le savez déjà, pour avoir un nombre aléatoire en PHP, il est facile d&#8217;utiliser la fonction Rand(min,max) qui tirera au sort un nombre entre min &#38; max C&#8217;est un peu plus complexe pour un tableau de valeur&#8230;Mais l&#8217;utilité est géniale: Pour faire du split testing Pour afficher des pub aléatoirement Pour faire toute sorte [...]]]></description>
			<content:encoded><![CDATA[<p>Vous le savez déjà, pour avoir un nombre aléatoire en PHP, il est facile d&#8217;utiliser la fonction Rand(min,max) qui tirera au sort un nombre entre <strong>min </strong>&amp; <strong>max</strong></p>
<p>C&#8217;est un peu plus complexe pour un tableau de valeur&#8230;Mais l&#8217;utilité est géniale:</p>
<ul>
<li>Pour faire du split testing</li>
<li>Pour afficher des pub aléatoirement</li>
<li>Pour faire toute sorte de chose que votre imagination vous dictera ( pseudo aléatoire dans un script d&#8217;auto-comment par exemple <img src='http://www.scripts-marketing.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</li>
</ul>
<p>Voici donc la fonction qui utilise un tableau:</p>
<pre class="brush: php; title: ;">

&lt;?php

function get_rand($array)
{
if (!is_array($array) array($array);//Si ce n'est pas un tableau, on transforme.
return $array[array_rand($array)];//Tirage au sort
}

?&gt;
</pre>
<p>Utilisation:</p>
<pre class="brush: php; title: ;">

&lt;?php

$valeurs = array('toto','titi','tutu','tata','tete');

echo get_rand($valeurs);//affichera toto ou titi ou tutu etc...

?&gt;
</pre>
<p>C&#8217;est tout simple mais réellement éfficace&#8230;Ce site étant un peu mon carnet de fonction, je la retrouverais donc pour mes développements futurs.</p>
<p>A vos commentaires.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/affichage-aleatoire-dun-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LFE, une classe et un outil pour faire vivre votre ferme.</title>
		<link>http://www.scripts-marketing.com/lfe-une-classe-et-un-outil-pour-faire-vivre-votre-ferme/</link>
		<comments>http://www.scripts-marketing.com/lfe-une-classe-et-un-outil-pour-faire-vivre-votre-ferme/#comments</comments>
		<pubDate>Fri, 21 May 2010 08:29:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Classe SEO php]]></category>
		<category><![CDATA[LFE Review]]></category>
		<category><![CDATA[tool LFE]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=141</guid>
		<description><![CDATA[Peut-être ne connaissez-vous pas cet outil de création automatique de Blog à la volée&#8230;Dans ce cas, cette petite classe ne vous sera pas d&#8217;une grande utilité ( quoi que ) Utilisateurs de LFE, Vous avez des Blogs non ? Personnellement j&#8217;ai arreté de compter après 15 000&#8230;Alors ces blogs sont bien sympathiques&#8230;Reste qu&#8217;il ne sont [...]]]></description>
			<content:encoded><![CDATA[<p>Peut-être ne connaissez-vous pas cet outil de création automatique de Blog à la volée&#8230;Dans ce cas, cette petite classe ne vous sera pas d&#8217;une grande utilité ( quoi que )</p>
<p>Utilisateurs de LFE, Vous avez des Blogs non ? Personnellement j&#8217;ai arreté de compter après 15 000&#8230;Alors ces blogs sont bien sympathiques&#8230;Reste qu&#8217;il ne sont pas très vivants. Des BL dans les posts, cool, des commentaires ? NADA &#8230; Un blog qui ne vit pas devient très vite soupçonneux pour le Webmaster du WPMU que vous êtes en train de <span style="text-decoration: line-through;">Spammer</span> visiter.</p>
<p>Alors pour faire vivre ces blogs, j&#8217;ai décidé de me coder un ch&#8217;tite class pour poster des commentaire anonymement sur mes blogs&#8230;Impossible soit dit en passant en RPC, sauf si on connait l&#8217;astuce.</p>
<p>A noter que fada de Dofollow et en plein dans le code, j&#8217;en avais zappé le nofollow par défaut dans les blogs, cette idée est donc utile seulement pour faire vivre un blog ( Merci à ce <a href="http://www.deliciouscadaver.com/" target="_blank">Black Hat Seo</a> pour la remarque qui m&#8217;a fait percuter ).</p>
<p>Je post et j&#8217;explique ensuite:</p>
<pre class="brush: php; title: ;">

&lt;?php

require ('ixr.class.php');//http://scripts.incutio.com/xmlrpc/
/**
 * WordPress_client
 *
 * @package
 * @author Jeremy A.
 * @copyright 2010
 * @version 1.0
 * @access public
 * @site www.scripts-marketing.com
 */
class WordPress_client
{
 private $url;
 private $login;
 private $pass;
 private $rpc;
 private $erreurs = array();
 public $useragent;
 /**
 * WordPress_client::__construct()
 *
 * @param mixed $url
 * @param mixed $login
 * @param mixed $pass
 * @param string $useragent
 * @return
 */
 public function __construct($url, $login, $pass, $useragent = '')
 {
 $this-&gt;url = $url;
 $this-&gt;login = trim($login);
 $this-&gt;pass = trim($pass);
 $this-&gt;useragent = (!$useragent)?'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)':$useragent;
 $this-&gt;rpc = new IXR_Client($this-&gt;url, false, 80, $this-&gt;useragent);
 }
 /**
 * WordPress_client::list_methods()
 *
 * @return
 */
 public function list_methods()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;system.listMethods&quot;);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Error ( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot; ) : &quot;;
 $this-&gt;erreurs[] = $this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 exit;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::verif_rpc()
 *
 * @return
 */
 public function verif_rpc()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getUsersBlogs&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 return false;
 }
 return true;
 }
 /**
 * WordPress_client::get_erreurs()
 *
 * @return
 */
 public function get_erreurs()
 {
 return $this-&gt;erreurs;
 }
 /**
 * WordPress_client::poster_article()
 *
 * @param mixed $titre
 * @param mixed $categorie
 * @param mixed $article
 * @return
 */
 public function poster_article($titre, $categorie = array(1), $article)
 {
 if (!is_int($categorie))
 {
 $this-&gt;erreurs[] = &quot;votre catégorie doit être un nombre.&quot;;
 }
 $status = $this-&gt;rpc-&gt;query(&quot;blogger.newPost&quot;,
 &quot;&quot;,
 &quot;&quot;,
 $this-&gt;login,
 $this-&gt;pass,
 &quot;&lt;title&gt;&quot;.$this-&gt;formate($titre).&quot;&lt;/title&gt;
 &lt;category&gt;$categorie&lt;/category&gt;&quot;.$this-&gt;formate($article),
 1);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Votre Article $titre semble posté sur votre blog mais une erreur dans la réponse renvoyée par votre Blog est survenue :&quot;;
 $this-&gt;erreurs[] = &quot;Erreur ( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot; ) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::poster_commentaire()
 *
 * @param mixed $author_mail
 * @param mixed $author_name
 * @param mixed $author_url
 * @param mixed $content
 * @return
 */
 public function poster_commentaire($author_mail, $author_name, $author_url, $content)
 {
 $articles = $this-&gt;recents_articles(5);
 foreach ($articles as $article)
 {
 $ids[] = $article['postid'];
 }
 $ids = (!is_array($ids))?(array)$ids:$ids;
 $post_id = array_rand(array_flip($ids), 1);
 if (!is_int($post_id))
 {
 $this-&gt;erreurs[] = &quot;souci au niveau de l'id.&quot;;
 }
 $comment['author'] = $author_name;
 $comment['author_email'] = $author_mail;
 $comment['author_url'] = $author_url;
 $comment['content'] = $content;
 $status = $this-&gt;rpc-&gt;query(&quot;wp.newComment&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass, $post_id,
 $comment);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur de commentaire :&quot;;
 $this-&gt;erreurs[] = &quot;Erreur ( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot; ) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 else
 {
 $this-&gt;editer_commentaire($this-&gt;rpc-&gt;getResponse(), $author_mail, $author_name,
 $author_url, $content);
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::editer_commentaire()
 *
 * @param mixed $post_id
 * @param mixed $author_mail
 * @param mixed $author_name
 * @param mixed $author_url
 * @param mixed $content
 * @return
 */
 public function editer_commentaire($post_id, $author_mail, $author_name, $author_url,
 $content)
 {
 if (!is_int($post_id))
 {
 $this-&gt;erreurs[] = &quot;L'id doit être un nombre.&quot;;
 }
 $comment['author'] = $author_name;
 $comment['author_email'] = $author_mail;
 $comment['author_url'] = $author_url;
 $comment['content'] = $content;
 $status = $this-&gt;rpc-&gt;query(&quot;wp.editComment &quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass, $post_id, $comment);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur de commentaire :&quot;;
 $this-&gt;erreurs[] = &quot;Erreur ( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot; ) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::recents_articles()
 *
 * @param mixed $nombre
 * @return
 */
 public function recents_articles($nombre)
 {
 $status = $this-&gt;rpc-&gt;query(&quot;blogger.getRecentPosts&quot;, &quot;&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass, $nombre);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur ( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot; ) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::recents_comments()
 *
 * @return
 */
 public function recents_comments()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getComments&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur ( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot; ) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::lister_categories()
 *
 * @return
 */
 public function lister_categories()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getCategories&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::lister_tags()
 *
 * @return
 */
 public function lister_tags()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getTags&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 else
 {
 return $this-&gt;rpc-&gt;getResponse();
 }
 }
 /**
 * WordPress_client::get_options()
 *
 * @param mixed $name
 * @return
 */
 public function get_options($name)
 {
 if (!$name)
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getOptions&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass);
 }
 else
 {
 $names = (!is_array($name))?(array )$name:$name;
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getOptions&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass, $names);
 }
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::get_authors()
 *
 * @return
 */
 public function get_authors()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getAuthors&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::get_theme()
 *
 * @return
 */
 public function get_theme()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getPageTemplates&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::get_users()
 *
 * @return
 */
 public function get_users()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.getUsersBlogs&quot;, $this-&gt;login, $this-&gt;pass);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::suggest_cat()
 *
 * @return
 */
 public function suggest_cat()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.suggestCategories&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass, 'twitter', 5);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur( &quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;) : &quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::set_options()
 *
 * @return
 */
 public function set_options()
 {
 $status = $this-&gt;rpc-&gt;query(&quot;wp.setOptions&quot;, &quot;&quot;, $this-&gt;login, $this-&gt;pass, $option);
 if (!$status)
 {
 $this-&gt;erreurs[] = &quot;Erreur(&quot;.$this-&gt;rpc-&gt;getErrorCode().&quot;):&quot;.$this-&gt;rpc-&gt;getErrorMessage().&quot;\n&quot;;
 }
 return $this-&gt;rpc-&gt;getResponse();
 }
 /**
 * WordPress_client::formate()
 *
 * @param mixed $texte
 * @return
 */
 private function formate($texte)
 {
 $cur_encoding = mb_detect_encoding($texte);
 $rep = ($cur_encoding == &quot;UTF-8&quot; &amp;&amp; mb_check_encoding($texte, &quot;UTF-8&quot;))? $texte : utf8_encode($texte);
 return $rep;
 }
 /**
 * WordPress_client::verif_url()
 * @tutorial permet de vérifier si une url est accessible
 * avant de faire toute autre opération dessus.
 * @param mixed $url
 * @return code header ( 200,302,404,... )
 */
 public function verif_url($url)
 {
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_HEADER, true);
 curl_setopt($ch, CURLOPT_NOBODY, true);
 curl_setopt($ch, CURLOPT_USERAGENT, $this-&gt;useragent);
 curl_setopt($ch, CURLOPT_REFERER, $url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_AUTOREFERER, true);
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
 curl_setopt($ch, CURLOPT_TIMEOUT, 20);
 curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
 $data = curl_exec($ch);
 curl_close($ch);
 return (preg_match(&quot;/HTTP\/1\.[1|0]\s(\d{3})/&quot;, $data, $matches))?$matches[1]:'error';
 }
}

?&gt;
</pre>
<p>Vous le remarquerez, cette classe est un bout d&#8217;une plus grosse bébête qui me convient un peu mieux que le fameux Script White Hat&#8230;</p>
<p>Il vous faut donc la lib IXR http://scripts.incutio.com/xmlrpc/ pour faire marcher la chose.</p>
<p>Le xmlrpc.php de WordPress empéchera tout webmaster connecté de publier sous un autre identifiant que &laquo;&nbsp;Admin&nbsp;&raquo; ou ce que vous avez mis par défaut dans votre configuration.</p>
<p>Pour celà, nous postons le commentaire en tant qu&#8217;admin, puis nous le modifions directement derrière avec l&#8217;id qui nous est retrourné par le Blog.</p>
<p>Exemple:</p>
<pre class="brush: php; title: ;">

$go = new WordPress_client($url, $login, $pass, $useragent = 'Google.com');
 //echo &quot;Commentaire sur $url&lt;hr/&gt;&quot;;

 if(!$go-&gt;poster_commentaire($email,$auteur,$url_commentaire,$commentaire))
 {
 echo &quot;&lt;p&gt;PAS OK sur $url&lt;/p&gt;&quot;;
 }
 else
 {
 echo &quot;&lt;p&gt;OK sur $url&lt;/p&gt;&quot;;
 }
</pre>
<p>Si vous êtes ici, vous codez surement donc je ne m&#8217;étalerais pas plus sur le fonctionnement que je vous laisse découvrir.</p>
<p>Cette classe est une première version de ce que j&#8217;ai pu faire pour mon projet personnel, je ne vais pas tout vous dire de suite tout de même.</p>
<p>à tantôt comme dirait <a href="http://motercalo.la-faucheuse.fr/">Motercalo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/lfe-une-classe-et-un-outil-pour-faire-vivre-votre-ferme/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Checker Duplicate Content PHP</title>
		<link>http://www.scripts-marketing.com/checker-duplicate-content-php/</link>
		<comments>http://www.scripts-marketing.com/checker-duplicate-content-php/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 14:21:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[Fonctions Utiles En Php]]></category>
		<category><![CDATA[anti duplicate content]]></category>
		<category><![CDATA[check DC]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=131</guid>
		<description><![CDATA[Une petite fonction sympa pour vérifier si vos articles ou bout de page sont dupliqués. Utile pour un annuaire ou autre vérification sur des commentaires de blog par exemple : &#60;?php /** * @author Jeremy A. * @copyright 2010 * @site: www.code-seo.com */ function check_dc($phrase,$longueur_max = 50) { $phrase = (strlen($phrase)&#62;=$longueur_max)? substr($phrase,0,$longueur_max) : $phrase; $phrase [...]]]></description>
			<content:encoded><![CDATA[<p>Une petite fonction sympa pour vérifier si vos articles ou bout de page sont dupliqués. Utile pour un annuaire ou autre vérification sur des commentaires de blog par exemple :</p>
<pre class="brush: php; title: ;">

&lt;?php

/**
 * @author Jeremy A.
 * @copyright 2010
 * @site: www.code-seo.com
 */

function check_dc($phrase,$longueur_max = 50)
{

 $phrase = (strlen($phrase)&gt;=$longueur_max)? substr($phrase,0,$longueur_max) : $phrase;
 $phrase = (strrpos($phrase,&quot; &quot;)) ? substr($phrase,0,strrpos($phrase,&quot; &quot;)):$phrase;

 $url = 'http://www.google.com/custom?hl=fr&amp;q=';
 $phrase = urlencode('&quot;'.$phrase.'&quot;');

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url.$phrase);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $data = curl_exec($ch);
 curl_close($ch);

 $regex =  '#Aucun document ne correspond#i';
 //retourne true si pas de DC
 return(preg_match($regex,$data))? true:false;

}

$test = &quot;Tout d'abord, les pages alias et les sous-domaines sont deux choses différentes, même si une page alias peut avoir une adresse en sous-domaine.&quot;;

echo (check_dc($test,110) == true)? &quot;Pas de duplicate&quot;:&quot;DC en vue chef&quot;;

?&gt;
</pre>
<p>Il ne reste ensuite qu&#8217;a traiter l&#8217;information reçue par la fonction&#8230;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/checker-duplicate-content-php/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Twitter, Avez-vous votre robot ?</title>
		<link>http://www.scripts-marketing.com/twitter-avez-vous-votre-robot/</link>
		<comments>http://www.scripts-marketing.com/twitter-avez-vous-votre-robot/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 10:20:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[alea twitter]]></category>
		<category><![CDATA[auto twitter]]></category>
		<category><![CDATA[fonction twitter post]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=97</guid>
		<description><![CDATA[Voici une petite fonction sympa pour Twitter Aléatoirement un message&#8230; Vos messages sont soit dans un tableau ( Array ) soit seul ( $message =&#160;&#187;toto&#160;&#187;; La fonction s&#8217;occupe d&#8217;elle même de transformer un message seul en tableau : /** * alea_twitter_post * Envois aléatoirement un Twitt * contenu dans un Array() * * @param string [...]]]></description>
			<content:encoded><![CDATA[<p>Voici une petite fonction sympa pour Twitter Aléatoirement un message&#8230; Vos messages sont soit dans un tableau ( Array ) soit seul ( $message =&nbsp;&raquo;toto&nbsp;&raquo;;</p>
<p>La fonction s&#8217;occupe d&#8217;elle même de transformer un message seul en tableau :</p>
<pre class="brush: php; title: ;">

/**
 * alea_twitter_post
 * Envois aléatoirement un Twitt
 * contenu dans un Array()
 *
 * @param string $login,$mot_de_passe
 * @param array $messages
 * @return $reponse|true ou false
 */

function alea_twitter_post($login, $mot_de_passe, $messages){
 if (!is_array($messages)){
 $messages = array($messages);
 }
 $message = $messages[array_rand($messages)];
 $url = 'http://twitter.com/statuses/update.xml';
 $curl_handle = curl_init();
 curl_setopt($curl_handle, CURLOPT_URL, &quot;$url&quot;);
 curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
 curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($curl_handle, CURLOPT_POST, 1);
 curl_setopt($curl_handle, CURLOPT_POSTFIELDS, &quot;status=$message&quot;);
 curl_setopt($curl_handle, CURLOPT_USERPWD, &quot;$login:$mot_de_passe&quot;);
 $buffer = curl_exec($curl_handle);
 curl_close($curl_handle);
 if (!empty($buffer)){
 $reponse = TRUE;
 }else{
 $reponse = FALSE;
 }
 return $reponse;
}
</pre>
<p>On peut ensuite tester ainsi:</p>
<pre class="brush: php; title: ;">

//TEST
$login = &quot;VotreLogin&quot;;
$pass = &quot;VotreMotDePasse&quot;;
$messages = array(&quot;Message 1&quot;,&quot;message 2&quot;,&quot;message 3&quot;,&quot;etc...&quot;);
// ou tout simplement $messages = &quot;Un petit dernier pour le e-commerce et pokerice&quot;;
if (alea_twitter_post($login, $pass, $messages) != FALSE){
echo &quot;Twitt Posté&quot;;
}
</pre>
<p>Rapide et éfficace, il ne reste plus qu&#8217;a en faire un Cron, charger des messages en Bdd, ou encore faire appeler cette fonction par image par vos visiteurs&#8230;</p>
<p>A vos commentaires <img src='http://www.scripts-marketing.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/twitter-avez-vous-votre-robot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fonction SEO, d&#8217;où vient mon visiteur</title>
		<link>http://www.scripts-marketing.com/fonction-seo-dou-vient-mon-visiteur/</link>
		<comments>http://www.scripts-marketing.com/fonction-seo-dou-vient-mon-visiteur/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 08:27:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Utiles En Php]]></category>
		<category><![CDATA[fonction php seo]]></category>
		<category><![CDATA[parse referer]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=68</guid>
		<description><![CDATA[D&#8217;ou vient le visiteur ? Une question a laquelle beaucoup de Webmaster aimerait répondre. Voici une petite fonction sympas pour retrouver facilement le mot clé, le moteur de recherche et la page de provenance d&#8217;un visiteur sur un site: function analyse($ref) { $refe = parse_url($ref); parse_str($refe['query'], $query); $host = $refe['host']; switch ($host){ //GOOGLE case (strpos($host, [...]]]></description>
			<content:encoded><![CDATA[<p>D&#8217;ou vient le visiteur ? Une question a laquelle beaucoup de Webmaster aimerait répondre.</p>
<p>Voici une petite fonction sympas pour retrouver facilement le mot clé, le moteur de recherche et la page de provenance d&#8217;un visiteur sur un site:</p>
<pre class="brush: php; title: ;">
function analyse($ref)
{
$refe = parse_url($ref);
parse_str($refe['query'], $query);
$host = $refe['host'];

switch ($host){
//GOOGLE
case (strpos($host, '.google.') !== false):
$moteur = &quot;Google&quot;;
$mot_cle = $query['q'];
$page = $query['start'];
if (!$page){
$page = 1;
} else {
$page = ($page / 10) + 1;
}
break;
//Yahoo
case (strpos($host, '.yahoo.') !== false):
$moteur = &quot;Yahoo&quot;;
$mot_cle = $query['p'];
$page = $query['b'];
if (!$page){
$page = 1;
} else {
$page = (($page - 1) / 10) + 1;
}
break;
//Bing
case (strpos($host, '.bing.') !== false):
$moteur = &quot;Bing&quot;;
$mot_cle = $query['q'];
$page = $query['first'];
if (!$page){
$page = 1;
} else {
$page = (($page - 1) / 10) + 1;
}
break;
//ALTAVISTA
case (strpos($host, '.altavista.') !== false):
$moteur = &quot;Altavista&quot;;
$mot_cle = $query['q'];
$page = $query['stq'];
if (!$page){
$page = 1;
} else {
$page = ($page / 10) + 1;
}
break;
//LYCOS
case (strpos($host, '.lycos.') !== false):
$moteur = &quot;Lycos&quot;;
$mot_cle = $query['query'];
$page = $query['page2'];
if (!$page){
/**
* particularitÃ© de lycos qui affiche un page2=0
* au lieu de ne rien afficher
*
*/
$page = &quot;1&quot;;
} else {
$page = $page + 1;
}
break;
//ALLTHEWEB
case (strpos($host, '.alltheweb.') !== false):
$moteur = &quot;All The Web&quot;;
$mot_cle = $query['q'];
$page = $query['o'];
if (!$page){
$page = 1;
} else {
$page = ($page / 10) + 1;
}
break;
}
return array(
'moteur' =&gt; stripslashes($moteur) ,
'mot' =&gt; stripslashes($mot_cle) ,
'page' =&gt; stripslashes($page)
);

}
</pre>
<p>Utilisation :</p>
<pre class="brush: php; title: ;">
$result = analyse($_SERVER['HTTP_REFERER']);
echo $result['moteur'] . '&lt;br /&gt;';
echo $result['mot'] . '&lt;br /&gt;';
echo $result['page'] . '&lt;br /&gt;';
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/fonction-seo-dou-vient-mon-visiteur/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Où sont les Bots ?</title>
		<link>http://www.scripts-marketing.com/ou-sont-les-bots/</link>
		<comments>http://www.scripts-marketing.com/ou-sont-les-bots/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 11:59:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[Fonctions Utiles En Php]]></category>
		<category><![CDATA[function is_bot]]></category>
		<category><![CDATA[pister bots]]></category>
		<category><![CDATA[tracking bots]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=63</guid>
		<description><![CDATA[Une petite fonction sympa pour surveiller les Bots ( save en BDD ou cloaking ) L&#8217;interêt de cette fonction et de pouvoir traiter des tableaux multiples en redéfinissant des plages d&#8217;ip éventuelles des Robots ou tout autre recherche que vous souhaiteriez traquer /** * Is_bot * traque la présence d'un bot par plage d'ip * [...]]]></description>
			<content:encoded><![CDATA[<h1>Une petite fonction sympa pour surveiller les Bots ( save en BDD ou cloaking )</h1>
<p>L&#8217;interêt de cette fonction et de pouvoir traiter des tableaux multiples en redéfinissant des plages d&#8217;ip éventuelles des Robots ou tout autre recherche que vous souhaiteriez traquer</p>
<pre class="brush: php; title: ;">
/**
 * Is_bot
 * traque la présence d'un bot par plage d'ip
 *
 * @param string $ip
 * @param array $array_bots
 * @return string|false
 */

function is_bot ($ip,$array_bots) {
    $ip = strval($ip);
    $reponse = false;
    foreach($array_bots as $bot=&gt;$val) {
	foreach($array_bots[$bot] as $ip_bot) {
	    $reponse = strpos($ip,$ip_bot);
	    if ($reponse !== FALSE) return $bot;
	}
    }
    return $reponse;
}
</pre>
<p>Utilisation:</p>
<pre class="brush: php; title: ;">
$bots = array(
    'google' =&gt; array('216.239.46','64.68.8','66.249.','64.233.173'),
    'yahoo' =&gt; array('66.196.','68.142.','202.165.','66.142.')
);
$test = is_bot('216.239.46.654',$bots); //renverra TRUE car 216.239.46 est présent dans l'ip
if($test != FALSE) {
    //action affichage bot ou cloaking <img src='http://www.scripts-marketing.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
    $bot = $test;
    echo &quot;bot présent&lt;br/&gt;&quot;;
    echo $bot;
} else {
    echo &quot;pas de bot&quot;;
}
</pre>
<p>Le code vous retourne donc un true ou false avec possibilité de reprendre le nom du bot.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/ou-sont-les-bots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trouve les derniers caractère d&#8217;un mot en PHP, utile pour detecter des terminaisons, ou des pluriels</title>
		<link>http://www.scripts-marketing.com/trouve-les-derniers-caractere-dun-mot-en-php-utile-pour-detecter-des-terminaisons-ou-des-pluriels/</link>
		<comments>http://www.scripts-marketing.com/trouve-les-derniers-caractere-dun-mot-en-php-utile-pour-detecter-des-terminaisons-ou-des-pluriels/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 08:53:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[Fonctions Utiles En Php]]></category>
		<category><![CDATA[dernier caractère]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=56</guid>
		<description><![CDATA[Une petite fonction pour trouver facilement des terminaisons ou des pluriels dans une chaîne function dernier_car($txt, $nb=1){ $dernier = substr($txt, strlen($txt)-$nb, $nb); return $dernier; } $nb est le nombre de caractère final que vous désirez retrouver. Utilisation: echo dernier_car('mots',3); Ceci affichera les trois dernières lettres de &#171;&#160;mots&#160;&#187; soit ots]]></description>
			<content:encoded><![CDATA[<h1>Une petite fonction pour trouver facilement des terminaisons ou des pluriels dans une chaîne</h1>
<pre class="brush: php; title: ;">
function dernier_car($txt, $nb=1){
$dernier = substr($txt, strlen($txt)-$nb, $nb);
return $dernier;
}
</pre>
<p>$nb est le nombre de caractère final que vous désirez retrouver.<br />
Utilisation:</p>
<pre class="brush: php; title: ;">
echo dernier_car('mots',3);
</pre>
<p>Ceci affichera les trois dernières lettres de &laquo;&nbsp;mots&nbsp;&raquo; soit <strong>ots</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/trouve-les-derniers-caractere-dun-mot-en-php-utile-pour-detecter-des-terminaisons-ou-des-pluriels/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Content Spinning ou la réécriture d&#8217;article pour le Web</title>
		<link>http://www.scripts-marketing.com/content-spinning-ou-la-reecriture-darticle-pour-le-web/</link>
		<comments>http://www.scripts-marketing.com/content-spinning-ou-la-reecriture-darticle-pour-le-web/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 11:06:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Classe SEO php]]></category>
		<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[content spinning]]></category>
		<category><![CDATA[réécriture d'article php]]></category>
		<category><![CDATA[spinning content]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=49</guid>
		<description><![CDATA[Une petite fonction pour réécrire rapidement des articles après transformation! Pokerice Utilisation des balises {} pour le contenant et tirage au sort par &#124;&#124; ==&#62; résultat: {mon&#124;ton&#124;son} ETC&#8230; function Spin($txt){ $test = preg_match_all(&#34;#\{(.*?)\}#&#34;, $txt, $out); if (!$test) return $txt; $atrouver = array(); $aremplacer = array(); foreach($out[0] as $id =&#62; $match) { $choisir = explode(&#34;&#124;&#34;, $out[1][$id]); [...]]]></description>
			<content:encoded><![CDATA[<h1>Une petite fonction pour réécrire rapidement des articles après transformation!</h1>
<p><a href="http://www.la-faucheuse.fr/pokerice/">Pokerice</a><br />
Utilisation des balises {} pour le contenant et tirage au sort par || ==&gt; résultat: {mon|ton|son} ETC&#8230;</p>
<pre class="brush: php; title: ;">
function Spin($txt){

	$test = preg_match_all(&quot;#\{(.*?)\}#&quot;, $txt, $out);

	if (!$test) return $txt;

	$atrouver = array();
	$aremplacer = array();

	foreach($out[0] as $id =&gt; $match)
	{
		$choisir = explode(&quot;|&quot;, $out[1][$id]);
		$atrouver[]=$match;
		$aremplacer[]=trim($choisir[rand(0, count($choisir)-1)]);
	}

	return str_replace($atrouver, $aremplacer, $txt);
}
</pre>
<p>Utilisation:</p>
<pre class="brush: php; title: ;">
echo Spin('{Salut|Coucou|Bonjour} {comment tu vas ?|comment vas-tu ?|est-ce-que ca va ?}');
</pre>
<p>Bientôt en ligne ici un plugin WordPress permettant l&#8217;importation d&#8217;articles rédigés selon cette méthode&#8230;</p>
<p>Scheduler intégré pour automatiser un blog complet <img src='http://www.scripts-marketing.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/content-spinning-ou-la-reecriture-darticle-pour-le-web/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Trouver la racine du site de provenance</title>
		<link>http://www.scripts-marketing.com/trouver-la-racine-du-site-de-provenance/</link>
		<comments>http://www.scripts-marketing.com/trouver-la-racine-du-site-de-provenance/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 11:07:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Utiles En Php]]></category>
		<category><![CDATA[parse_url]]></category>
		<category><![CDATA[trouver referer php]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=46</guid>
		<description><![CDATA[Une petite fonction pour retrouver le nom de domaine du site de provenance ( www.site.com ) function racine_referer() { if (!isset($_SERVER['HTTP_REFERER'])) { return 'pas de referer'; } else { $parser_url = parse_url(trim($_SERVER['HTTP_REFERER'])); return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2))); } } Utilisation: $val = racine_referer(); echo $val;]]></description>
			<content:encoded><![CDATA[<h1>Une petite fonction pour retrouver le nom de domaine du site de provenance ( www.site.com )</h1>
<pre class="brush: php; title: ;">
function racine_referer()
{
	if (!isset($_SERVER['HTTP_REFERER']))
	{
	return 'pas de referer';
	}
	else
	{
	$parser_url = parse_url(trim($_SERVER['HTTP_REFERER']));
	return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2)));
	}
}
</pre>
<p>Utilisation:</p>
<pre class="brush: php; title: ;">
$val = racine_referer();
echo $val;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/trouver-la-racine-du-site-de-provenance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utiliser TinyUrl ( Pour Twitter par exemple )</title>
		<link>http://www.scripts-marketing.com/utiliser-tinyurl-pour-twitter-par-exemple/</link>
		<comments>http://www.scripts-marketing.com/utiliser-tinyurl-pour-twitter-par-exemple/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 07:42:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Fonctions Sympas]]></category>
		<category><![CDATA[tinyurl fonction]]></category>
		<category><![CDATA[utiliser tinyurl en PHP]]></category>

		<guid isPermaLink="false">http://www.scripts-marketing.com/?p=32</guid>
		<description><![CDATA[Une fonction sympathique pour utiliser l&#8217;API de TinyUrl ( un service d&#8217;urls courtes ) function url_courte($url) { $curl = curl_init(); curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url); curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,7); $resultat = curl_exec($curl); curl_close($curl); if(!$resultat){ //en cas de suspension du service Tinyurl.com return $url; } return $resultat; } Utilisation: $url = url_courte ('http://www.site.com'); // ou ($_POST['url']) par exemple echo $url; Plus d&#8217;info [...]]]></description>
			<content:encoded><![CDATA[<h1>Une fonction sympathique pour utiliser l&#8217;API de TinyUrl ( un service d&#8217;urls courtes )</h1>
<pre class="brush: php; title: ;">
function url_courte($url)
{
    $curl = curl_init();
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
    curl_setopt($curl,CURLOPT_URL,'http://tinyurl.com/api-create.php?url='.$url);
    curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,7);
    $resultat = curl_exec($curl);
    curl_close($curl);
	if(!$resultat){ //en cas de suspension du service Tinyurl.com
	return $url;
	}
    return $resultat;
}
</pre>
<p>Utilisation:</p>
<pre class="brush: php; title: ;">
$url = url_courte ('http://www.site.com'); // ou ($_POST['url']) par exemple
echo $url;
</pre>
<p>Plus d&#8217;info sur <a href="http://fr.php.net/curl">CURL ICI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scripts-marketing.com/utiliser-tinyurl-pour-twitter-par-exemple/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

