Bonjour,
je tente de réaliser un petit script sous curl afin de poster a distance et surtout dans un temps déterminé par avance sur site partenaire. (ce site m'autorise a poster un article par jours, or je publie mes articles le samedi pour toute la semaine. j'essaye donc de créer un script qui propose mes publications chez ce partenaire tout les jours, via un cron)
je m'exerce avant sur le site blogmarks.net (parce que le formulaire est simple et qu'il fallait bien un site de test)
voici mon script
Code:
<?php
define('LOGIN', 'moncompte');
define('PASSWORD', 'monmotdepasse');
define('AUTHENTIFICATION', 'http://blogmarks.net/');
define('PAGE_PRIVEE', 'http://blogmarks.net/my/marks,new');
$ch = curl_init(AUTHENTIFICATION);
curl_setopt($ch, CURLOPT_POST, TRUE);
//les variables demandé par le formulaire d'identification
curl_setopt($ch, CURLOPT_POSTFIELDS,
array(
'login' => LOGIN,
'pwd' => PASSWORD,
'connect' => 1
)
);
curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$ret = curl_exec($ch);
//variable demandé lors du formulaire de soumission de mon marque page
$postfields = array();
$postfields["action"] = "submit";
$postfields["new_titre"] = "mon titre";
$postfields["new_url"] = "http://www.monsite.com/mon-article/";
$postfields["new_description"] = "description de mon article";
$postfields["new-publictags"] = "tag,de,mon,article";
$postfields["new-privatetag"] = "";
$postfields["new-via"] = "http://www.monsite.com";
$postfields["referer"] = "http://blogmarks.net/my/";
$postfields["post-token"] = "MTI0NzM4ODE1Nw=="; //ca je sais pas ce que c'est mais apparement c'est la meme valeur meme si je rafraichi la page.
$useragent = "Mozilla/5.0";
$referer = "http://blogmarks.net/my/";
//Initialise la session CURL sur la page authentification effectuée
$ch = curl_init(PAGE_PRIVEE);
//CURL options
curl_setopt($ch, CURLOPT_POST, 1);
//On poste les données du tableau $postfields
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt($ch, CURLOPT_REFERER, $referer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
?>
Mais cela ne fonctionne pas , j'ai une page blanche, et aucun ajout dans mes blogmarks préférés.
j'ai beau retourner le script dans tous les sens, je ne vois pas.
le script est plus que basé sur les 2 articles suivants:
developpezSEOblackOutMerci par avance de votre aide
