Advertisement
Guest User

Tes curl

a guest
Feb 9th, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2. // Setting Username dan Password
  3. $username = $_POST['email'];
  4. $password = $_POST['pwd'];
  5.  
  6. $ch = curl_init('http://localhost/curl/login.php');
  7. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  8. curl_setopt($ch,CURLOPT_POST,1);
  9.         curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
  10.         curl_setopt($ch,CURLOPT_POST,TRUE);
  11.         curl_setopt($ch,CURLOPT_FOLLOWLOCATION,TRUE);
  12.         curl_setopt($ch,CURLOPT_COOKIEFILE,"ikisme.txt");
  13.         curl_setopt($ch,CURLOPT_COOKIEJAR, "ikisme.txt");
  14. curl_setopt($ch,CURLOPT_POSTFIELDS,"email='.$username.'&password='.$password.'");
  15. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  16. $result = curl_exec($ch);
  17. if ($result == "OK") {
  18.         echo"Anda berhasil login";
  19.     } else {
  20.         echo"Login gagal coba lagi";
  21.     }
  22. curl_close ($ch);
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement