Skip to content

Instantly share code, notes, and snippets.

@titomus
titomus / male-alpha.html
Last active September 25, 2018 12:27
Psychologie du mâle Alpha - code formulaire
<form action="http://le-saint-homme.fr/wp-comments-post.php" method="post" id="commentform" class="comment-form" novalidate="">
<p class="comment-form-comment">
<label for="comment">Commentaire</label>
<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p><p class="form-submit"><input name="submit" type="submit" id="submit" class="submit" value="Laisser un commentaire"> <input type="hidden" name="comment_post_ID" value="116" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</p><input type="hidden" id="_wp_unfiltered_html_comment_disabled" name="_wp_unfiltered_html_comment" value=""><script>(function(){if(window===window.parent){document.getElementById('_wp_unfiltered_html_comment_disabled').name='_wp_unfiltered_html_comment';}})();</script>
</form>
@titomus
titomus / fake-df.php
Created August 10, 2017 07:46
Fake Dofollow
<?php
function fake_df(){
header("X-Robots-Tag: nofollow", true);
}
// utilisation (ATTENTION: à utiliser avant affichage de la page sinon ERROR)
fake_df
<?php
/*
--------------------------------------------
$title contains the title of the page you're sending
$url is the url of the page
$debug true print out the debug and show xml call and answer
--------------------------------------------
the output is an array with two elements:
status: ok / ko
msg: the text response from pingomatic
@titomus
titomus / scrape-links.php
Created August 10, 2017 07:26
Récupérer les liens présents sur une page
@titomus
titomus / get_site_kw.php
Last active August 10, 2017 07:24
Récupérer les mots clés d'un site web via sa balise meta keywords
<?php
function get_site_kw($url){
$meta = get_meta_tags($url);
$keywords = $meta['keywords'];
$keywords = @explode(',', $keywords );
$keywords = array_map( 'trim', $keywords );
$keywords = array_filter( $keywords );
return $keywords;
@titomus
titomus / racine-referer.php
Created August 10, 2017 07:19
Récupérer la racine du referer
<?php
function racine_referer()
{
if (!isset($_SERVER['HTTP_REFERER'])){
return false;
}else{
$parser_url = parse_url(trim($_SERVER['HTTP_REFERER']));
return trim($parser_url[host] ? $parser_url[host] : array_shift(explode('/', $parser_url[path], 2)));
}
}
@titomus
titomus / get-search-num.php
Created August 10, 2017 07:17
Function pour récupérer le nombre de résultats Google (FR)
<?php
function get_search_num($keyword){
$url = sprintf('http://www.google.fr/search?pws=0&hl=fr&q=%s', $keyword);
$data = file_get_contents($url);
$pattern = sprintf(
'/%s(.*?)%s/',
preg_quote('Environ'),
preg_quote('résultats')
);
@titomus
titomus / is_bot.php
Created August 10, 2017 07:11
Detecter les crawlers des moteurs de recherche
<?php
/**
* Is_bot
* traque la présence d'un bot par plage d'ip
*
* @param string $ip
* @param array $array_bots
* @return string|false
*/
@titomus
titomus / analyse_seo.php
Last active February 14, 2022 16:29
Récupérer moteur, mot clé et page de la provenance du visiteur
<?php
function analyse($ref){
$refe = parse_url($ref);
parse_str($refe['query'], $query);
$host = $refe['host'];
switch ($host){
//GOOGLE
case (strpos($host, '.google.') !== false):
$moteur = "Google";
@titomus
titomus / spin.php
Created August 10, 2017 07:04
Fonction PHP pour spinner du contenu SEO
<?php
function spin($txt){
$pattern = '#\{([^{}]*)\}#msi';
$test = preg_match_all($pattern, $txt, $out);
if(!$test)
return $txt;
$a_trouver = array();
$a_remplacer = array();