PHP CUrl wont login -
<?php $username = 'myuser'; $password = 'mypass'; $loginurl = 'https://www.cbs.com/user/signup/'; //init curl $ch = curl_init(); //set url work curl_setopt($ch, curlopt_url, $loginurl); // enable http post curl_setopt($ch, curlopt_post, 1); //set post parameters curl_setopt($ch, curlopt_postfields, 'j_username='.$username.'&j_password='.$password); //handle cookies login curl_setopt($ch, curlopt_cookiejar, 'cookie.txt'); //setting curlopt_returntransfer variable 1 force curl //not print out results of query. //instead, return results string return value //from curl_exec() instead of usual true/false. curl_setopt($ch, curlopt_returntransfer, 1); //execute request (the login) $store = curl_exec($ch); //the login done , can continue //protected content. //set url protected file curl_setopt($ch, curlopt_url, 'urliwannagrab'); //execute request $content = curl_exec($ch); //save data disk file_put_contents('content.php', $content); ?>
ok im trying make code login , grab line of text theres no action url instead says javascript:void(0) action cbsaccount.session.logintohttps('id-v3-account-login-form'); in code go add , make login correctly? or ideas great thanks!!
Comments
Post a Comment