Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: pato3_3 en 2 Febrero 2012, 13:30 pm



Título: CURL para actualizar Tuenti (PHP)
Publicado por: pato3_3 en 2 Febrero 2012, 13:30 pm
Estoy intentando actualizar Tuenti con Curl, pero lo único que consegui fue que el servidor me dijera que no actualizaba porque le parecia sospechoso.
Codigo:
Código
  1. <?php
  2. $handler = curl_init();
  3. curl_setopt($handler, CURLOPT_POST, false);
  4. curl_setopt($handler, CURLOPT_COOKIEJAR,"cookie.txt");
  5. curl_setopt($handler, CURLOPT_COOKIEFILE,"cookie.txt");
  6. curl_setopt($handler, CURLOPT_URL, "http://m.tuenti.com/?m=login");
  7. curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  8. curl_setopt($handler, CURLOPT_FRESH_CONNECT, true);
  9. curl_setopt($handler, CURLOPT_COOKIESESSION, "cookie.txt");
  10. $prueba = curl_exec($handler);
  11. $handler = curl_init();
  12. curl_setopt($handler, CURLOPT_POST,true);
  13. curl_setopt($handler, CURLOPT_COOKIEJAR,"cookie.txt");
  14. curl_setopt($handler, CURLOPT_COOKIEFILE,"cookie.txt");
  15. curl_setopt($handler, CURLOPT_URL, "http://m.tuenti.com/?m=login&func=process_login");
  16. curl_setopt($handler, CURLOPT_POSTFIELDS,"tuentiemail=EMAILDETUENTI&password=PASSWORDDETUENTI");
  17. curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  18. curl_setopt($handler, CURLOPT_FRESH_CONNECT, true);
  19. curl_setopt($handler, CURLOPT_COOKIESESSION, "cookie.txt");
  20. $prueba = curl_exec($handler);
  21. $handler = curl_init();
  22. curl_setopt($handler, CURLOPT_POST,false);
  23. curl_setopt($handler, CURLOPT_COOKIEJAR,"cookie.txt");
  24. curl_setopt($handler, CURLOPT_COOKIEFILE,"cookie.txt");
  25. curl_setopt($handler, CURLOPT_URL, "http://m.tuenti.com/");
  26. curl_setopt($handler, CURLOPT_USERAGENT,"Mozilla/5.0 (Linux; U; Android 2.2; en-us; T-Mobile G2 Build/FRF91) AppleWebKit/533.1(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
  27. curl_setopt($handler, CURLOPT_HTTPHEADER, array("Accept-Language: es-es,es;q=0.8", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Proxy-Connection: keep-alive", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3"));
  28. curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  29. curl_setopt($handler, CURLOPT_FRESH_CONNECT, true);
  30. curl_setopt($handler, CURLOPT_COOKIESESSION, "cookie.txt");
  31. $prueba = curl_exec($handler);
  32. preg_match('/(csfr=)([a-zA-Z0-9]{8})/', $prueba, $total);
  33. $texto = urlencode("ñ");
  34. $handler = curl_init();
  35. curl_setopt($handler, CURLOPT_POST,true);
  36. curl_setopt($handler, CURLOPT_COOKIEJAR,"cookie.txt");
  37. curl_setopt($handler, CURLOPT_COOKIEFILE,"cookie.txt");
  38. curl_setopt($handler, CURLOPT_COOKIESESSION, "cookie.txt");
  39. curl_setopt($handler, CURLOPT_URL, "http://m.tuenti.com/?m=Profile&f=processSetStatus&csrf=$total[2]");
  40. curl_setopt($handler, CURLOPT_USERAGENT,"Mozilla/5.0 (Linux; U; Android 2.2; en-us; T-Mobile G2 Build/FRF91) AppleWebKit/533.1(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
  41. curl_setopt($handler, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded","Content-Length: 23","Host: m.tuenti.com","Accept-Language: es-es,es;q=0.8", "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Proxy-Connection: keep-alive", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3"));
  42. curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
  43. curl_setopt($handler, CURLOPT_REFERER, "http://m.tuenti.com/?m=Profile&f=processSetStatus&csrf=$total[2]");
  44. curl_setopt($handler, CURLOPT_POSTFIELDS,"from=Home&status=$texto");
  45. $response = curl_exec($handler);
  46. echo $response;
  47. ?>
Alguien sabe como arreglarlo?