Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $username = 'user';
- $password = 'pass';
- $loginUrl = 'http://somewebsite.com/login/';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $loginUrl);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, 'uname='.$username.'&shipping=1&sum=&upass='.$password); //тук виж form-a кви скрити полета и т.н. има - трябва да изпращаш всички полета, които имат и те!
- curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_USERAGENT,
- "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7");
- $store = curl_exec($ch);
- //тук отваряме url-а, който ти е protected content-a
- curl_setopt($ch, CURLOPT_URL, 'http://somewebsite.com/protectedContent');
- //execute the request
- $content = curl_exec($ch);
- echo $content; //protected huinq data
- curl_close($ch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement