Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Logowanie przez curl
rad11
post
Post #1





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


Probuje polaczyc sie curlem:

  1.  
  2. $username = 'xxxx';
  3. $password = 'xxxxx';
  4. $loginUrl = 'http://runkeeper.com/login';
  5.  
  6. //init curl
  7. $ch = curl_init();
  8.  
  9. //Set the URL to work with
  10. curl_setopt($ch, CURLOPT_URL, $loginUrl);
  11.  
  12. // ENABLE HTTP POST
  13. curl_setopt($ch, CURLOPT_POST, 1);
  14.  
  15. //Set the post parameters
  16. curl_setopt($ch, CURLOPT_POSTFIELDS, 'email='.urlencode($username).'&password='.$password);
  17.  
  18. //Handle cookies for the login
  19. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
  20.  
  21. //Setting CURLOPT_RETURNTRANSFER variable to 1 will force cURL
  22. //not to print out the results of its query.
  23. //Instead, it will return the results as a string return value
  24. //from curl_exec() instead of the usual true/false.
  25. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  26.  
  27. //execute the request (the login)
  28. $store = curl_exec($ch);
  29.  
  30. //the login is now done and you can continue to get the
  31. //protected content.
  32.  
  33. //execute the request
  34. $content = curl_exec($ch);
  35.  


ale $content ani $store nic nie zwraca jakies pomysly jak to zrobic inaczej?
Go to the top of the page
+Quote Post

Posty w temacie
- rad11   [PHP]Logowanie przez curl   28.12.2014, 11:38:24
- - masa95   Spróbuj tak [PHP] pobierz, plaintext  $user...   28.12.2014, 11:41:46
- - rad11   To samo   28.12.2014, 11:44:29
- - masa95   A masz echo $store; ? Bo z tego co pamietam t...   28.12.2014, 11:47:35
- - rad11   Tak z echem tez pustka jest.   28.12.2014, 11:48:54
- - _Borys_   Logujesz się do strony z certyfikatem. Może pomoże...   28.12.2014, 14:19:48
- - rad11   Zadzialalo , a teraz sorry za glupie pytania ale w...   28.12.2014, 20:10:50


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 09:23