Guest User

Untitled

a guest
Feb 9th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. define("COOKIE_FILE", "cookie.txt");
  2. $url = "https://example.com/login/";
  3. $username = 'username';
  4. $password = 'password';
  5.  
  6. $ch = curl_init();
  7. curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
  8. curl_setopt($ch, CURLOPT_URL,$url);
  9. curl_setopt($ch, CURLOPT_POST, 1);
  10. curl_setopt($ch, CURLOPT_POSTFIELDS, "UserName=$username&Password=$password");
  11. curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  12.  
  13. $buf = curl_exec ($ch);
  14. curl_close ($ch);
  15. unset($ch);
  16. echo $buf;
Add Comment
Please, Sign In to add comment