Mam problem, ponieważ pewna część kodu cURL się nie wykonuje:

  1. <?php
  2.  
  3. $login = rand(1,999999);
  4. $haslo = rand(1,999999);
  5. $email = rand(1,999999);
  6. /**
  7. $zmienna="$login::$haslo::$email\n";
  8. if (!file_put_contents('baza.txt',$zmienna,FILE_APPEND | LOCK_EX));
  9. **/
  10.  
  11. $s = substr(str_shuffle(str_repeat("abcdefghijklmnopqrstuvwxyz", 5)), 0, 5);
  12. $hand = curl_init();
  13. $hand1 = curl_init();
  14. $hand2 = curl_init();
  15. $hand3 = curl_init();
  16. $hand4 = curl_init();
  17.  
  18.  
  19.  
  20. // hand 1 //
  21.  
  22. curl_setopt($hand, CURLOPT_URL, 'http://localhost/?subtopic=createaccount&action=saveaccount');
  23. curl_setopt($hand, CURLOPT_POST, 1);
  24. // curl_setopt($hand, CURLOPT_RETURNTRANSFER, 1); //
  25. curl_setopt($hand, CURLOPT_POSTFIELDS, 'reg_name='.$login.'&reg_email='.$email.'%40dasdas.pl&reg_password='.$haslo.'&reg_password2='.$haslo.'&reg_referrer=&rulesServer=true&rules=true&I+Agree.x=52&I+Agree.y=7');
  26. curl_exec($hand);
  27. curl_close($hand);
  28.  
  29. // hand2 //
  30. curl_setopt($hand1, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement');
  31. curl_setopt($hand1, CURLOPT_POST, 1);
  32. curl_setopt($hand1, CURLOPT_POSTFIELDS, 'account_login='.$login.'&password_login='.$haslo.'&Submit.x=87&Submit.y=14');
  33. curl_exec($hand1);
  34. curl_close($hand1);
  35.  
  36. // hand4 //
  37.  
  38. curl_setopt($hand3, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement&action=createcharacter');
  39. curl_setopt($hand3, CURLOPT_POST, 1);
  40. curl_setopt($hand3, CURLOPT_POSTFIELDS, 'world=0&savecharacter=1&newcharname=mades&newcharsex=1&newcharvocation=1&Submit.x=62&Submit.y=14');
  41. curl_exec($hand3);
  42. curl_close($hand3);
  43.  
  44. // hand5 //
  45.  
  46. curl_setopt($hand4, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement&action=logout');
  47. curl_setopt($hand4, CURLOPT_POST, 1);
  48. curl_setopt($hand4, CURLOPT_POSTFIELDS, 'Logout.x=62&Logout.y=14');
  49. curl_exec($hand4);
  50. curl_close($hand4);
  51. ?>

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
  1. // hand4 //
  2.  
  3. curl_setopt($hand3, CURLOPT_URL, 'http://localhost/?subtopic=accountmanagement&action=createcharacter');
  4. curl_setopt($hand3, CURLOPT_POST, 1);
  5. curl_setopt($hand3, CURLOPT_POSTFIELDS, 'world=0&savecharacter=1&newcharname=mades&newcharsex=1&newcharvocation=1&Submit.x=62&Submit.y=14');
  6. curl_exec($hand3);
  7. curl_close($hand3);