Advertisement
Guest User

Untitled

a guest
May 8th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.60 KB | None | 0 0
  1. <?php
  2. function randString($length, $charset='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
  3. {
  4.     $str = '';
  5.     $count = strlen($charset);
  6.     while ($length--) {
  7.         $str .= $charset[mt_rand(0, $count-1)];
  8.     }
  9.     return $str;
  10. }
  11.  
  12. $username = ''; //login
  13. $password = ''; //hasło
  14. $loginUrl = 'http://xn.pl/index.php?strona=konto';
  15.  
  16. //init curl
  17. $ch = curl_init();
  18. curl_setopt($ch, CURLOPT_URL, $loginUrl);
  19. curl_setopt($ch, CURLOPT_POST, 1);
  20. curl_setopt($ch, CURLOPT_POSTFIELDS, 'userid='.$username.'&haslo='.$password.'&zaloguj=Ok');
  21. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  22. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  23.  
  24. //execute the request (the login)
  25. $store = curl_exec($ch);
  26. echo 'Zalogowano ';
  27.  
  28. //Adding alias
  29. $aliasUrl = 'http://xn.pl/index.php?strona=konto&id=2';
  30. $aliasDdomain = ' LINK BEZ WWW ANI HTTP '.rand(1,99999999); //tutaj domena jaka ma byc podpięta pod alias oraz randomowa liczba od 1 do 99999999 WAŻNE! adres strony bez http://, https:// czy wwww
  31. $aliasName = randString(10); //10 to liczba generowanych znaków
  32.  
  33. curl_setopt($ch, CURLOPT_URL, $aliasUrl);
  34. curl_setopt($ch, CURLOPT_POST, 1);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, 'dodaj_alias=Ok&alias='.$aliasName.'&domena=xn.pl&url='.$aliasDdomain.'&kategoria=6');
  36.  
  37. $added = curl_exec($ch);
  38. echo 'Dodano';
  39.  
  40. //wylogowywanie z serwisu (nie potrzebne aktualnie)
  41. /*
  42. $logoutUrl = 'http://xn.pl/index.php?strona=konto&id=3';
  43.  
  44. //Set the URL to work with
  45. curl_setopt($ch, CURLOPT_URL, $logoutUrl);
  46. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  47. $logout = curl_exec($ch);
  48. echo $logout;
  49. */
  50.  
  51. curl_close($ch);
  52.  
  53. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement