Bonjour à tous,

Voilà maintenant plusieurs jours que je galère sur un problème assez ennuyant...
J'ai déjà postulé sur un forum malhereusement nous n'avons pas trouvé de solution.

Mon script doit pouvoir automatiser la mise en ligne d'en article sur un blog. Mon script fonctionne déjà correctement sur plusieurs hébergeurs mais sur celui là, ça bloque!

J'ai l'impression que le script envoie mal les infos POST. Peut-etre que j'ai omis quelque choses quelque part...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
 
//Initialisation session/variables
$session = curl_init();
$content = null;
$cookie = '/var/www/connection.txt';
 
if (!file_exists($cookie))
    touch($cookie) or die("Impossible de créer le fichier cookie<br />".$cookie);
 
 
 
/****************************************/
/* Connection sur CanalBlog **************/
 
//Initialisation du postfields
$posts = array(
    'errorReturnTo' => '/cf/login.cfm',
    'erroron'       => '',
    'memberid'      => 'LoG',
    'password'      => 'PaSS',
    'returnTo'      => ''
);
 
$url = "https://www.canalblog.com/cf/security/SessionController.cfc?method=login";
 
$options = array(
    CURLOPT_URL             => $url,
    //CURLOPT_URL               => "http://www.canalblog.com/",
    CURLOPT_TIMEOUT         => 60,
    CURLOPT_CONNECTTIMEOUT  => 60,
    CURLOPT_RETURNTRANSFER  => true,
    CURLOPT_FRESH_CONNECT   => true,
    CURLOPT_NOBODY          => false,
    CURLOPT_FOLLOWLOCATION  => true,
    CURLOPT_USERAGENT       => "Mozilla/5.0",
    CURLOPT_SSL_VERIFYPEER  => true,
    CURLOPT_SSL_VERIFYHOST  => 2,
    CURLOPT_CAINFO          => "/var/www/ca.canalblog.crt",
    CURLOPT_COOKIESESSION   => true,
    CURLOPT_POST            => true,
    CURLOPT_POSTFIELDS      => $posts,
    CURLOPT_COOKIEJAR       => $cookie,
    CURLOPT_REFERER         => "http://www.canalblog.com/",
);
 
curl_setopt_array($session, $options);
 
//Execution de la commande
$content = curl_exec($session)  or die("/!\ Erreur 0.1 curl_exec(\$session)<br />".curl_errno($session));
var_dump($content);
 
echo $content;
 
 
/****************************************/
/* Envoie d'un article ******************/
 
 
//Initialisation du postfields
$posts = array(
    'blogCatId'                 => 0,
    'dateTimeToP'               => date('Ymj,Hi'),
    'dayToP'                    => 21,
    'hourToP'                   => 13,
    'ischangedt'                => 0,
    'isnewpost'                 => 1,
    'minToP'                    => 03,
    'monthToP'                  => 09,
    'pid'                       => 28061582,
    'postIsComments'            => 1,
    'postIsConvertLineBreaks'   => 0,
    'postState'                 => 1,
    'postTags',
    'postText'                  => '<p>AutOGenerAT</p>',
    'postTitle'                 => 'La generation meme',
    'yearToP'                   => 2013
);
 
$options = array(
    CURLOPT_URL             => "http://www.canalblog.com/cf/my/action/PostController.cfc?bid=1166886&method=publishPost&ajaxsave=true",
    CURLOPT_REFERER         => "http://www.canalblog.com/cf/my/?nav=blog.manage&bid=1166886",
    CURLOPT_TIMEOUT         => 60,
    CURLOPT_CONNECTTIMEOUT  => 60,
    CURLOPT_RETURNTRANSFER  => true,
    CURLOPT_FRESH_CONNECT   => true,
    CURLOPT_SSL_VERIFYPEER  => false,
    CURLOPT_SSL_VERIFYHOST  => false,
    CURLOPT_NOBODY          => true,
    CURLOPT_USERAGENT       => "Mozilla/5.0",
    CURLOPT_COOKIESESSION   => true,
    CURLOPT_COOKIEFILE      => $cookie,
    CURLOPT_POST            => true,
    CURLOPT_POSTFIELDS      => $posts,
);
curl_setopt_array($session, $options);
 
//Execution de la commande
$content = curl_exec($session) or die("/!\ Erreur 0.2 curl_exec(\$session)<br />".curl_errno($session));
 
 
//Fermeture de la session, libération des cookies
unlink($cookie);
curl_close($session);
 
?>