Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ddcurl_login($url, $username, $password) {
- $ch = curl_init();
- $post_data = array(
- 'username' => $username,
- 'password' => $password
- );
- //$post_data = "username=$username&password=$password";
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_FAILONERROR, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
- curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)');
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
- $data = curl_exec ($ch);
- curl_close ($ch);
- return $data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement