Mam problem, ponieważ pewna część kodu cURL się nie wykonuje:
<?php
/**
$zmienna="$login::$haslo::$email\n";
if (!file_put_contents('baza.txt',$zmienna,FILE_APPEND | LOCK_EX));
**/
$hand = curl_init();
$hand1 = curl_init();
$hand2 = curl_init();
$hand3 = curl_init();
$hand4 = curl_init();
// hand 1 //
curl_setopt($hand, CURLOPT_URL, 'http://localhost/?subtopic=createaccount&action=saveaccount');
curl_setopt($hand, CURLOPT_POST, 1);
// curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1); //
curl_setopt($hand, CURLOPT_POSTFIELDS, 'reg_name='.$login.'®_email='.$email.'%40dasdas.pl®_password='.$haslo.'®_password2='.$haslo.'®_referrer=&rulesServer=true&rules=true&I+Agree.x=52&I+Agree.y=7');
curl_exec($hand);
curl_close($hand);
// hand2 //
curl_setopt($hand1, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement');
curl_setopt($hand1, CURLOPT_POST, 1);
curl_setopt($hand1, CURLOPT_POSTFIELDS, 'account_login='.$login.'&password_login='.$haslo.'&Submit.x=87&Submit.y=14');
curl_exec($hand1);
curl_close($hand1);
// hand4 //
curl_setopt($hand3, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement&action=createcharacter');
curl_setopt($hand3, CURLOPT_POST, 1);
curl_setopt($hand3, CURLOPT_POSTFIELDS, 'world=0&savecharacter=1&newcharname=mades&newcharsex=1&newcharvocation=1&Submit.x=62&Submit.y=14');
curl_exec($hand3);
curl_close($hand3);
// hand5 //
curl_setopt($hand4, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement&action=logout');
curl_setopt($hand4, CURLOPT_POST, 1);
curl_setopt($hand4, CURLOPT_POSTFIELDS, 'Logout.x=62&Logout.y=14');
curl_exec($hand4);
curl_close($hand4);
?>
Na początku wszystko przebiega pomyślnie. Konto się tworzy, skrypt loguje się na konto i tutaj jest problem. Powinien po drodze założyć postać, a pomija ten krok i od razu się wylogowuje.
Jakieś pomysły?
Ten kawałek kodu nie działa jak należy
// hand4 //
curl_setopt($hand3, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement&action=createcharacter');
curl_setopt($hand3, CURLOPT_POST, 1);
curl_setopt($hand3, CURLOPT_POSTFIELDS, 'world=0&savecharacter=1&newcharname=mades&newcharsex=1&newcharvocation=1&Submit.x=62&Submit.y=14');
curl_exec($hand3);
curl_close($hand3);
Ten post edytował Mades 19.08.2013, 19:20:01