Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define("COOKIE_FILE", "cookie.txt");
- $url = "https://example.com/login/";
- $username = 'username';
- $password = 'password';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIE_FILE);
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, "UserName=$username&Password=$password");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- $buf = curl_exec ($ch);
- curl_close ($ch);
- unset($ch);
- echo $buf;
Add Comment
Please, Sign In to add comment