PHP - cURL + strpos Issues -
i have script in checks if tested netflix account works. reason refuses work dont know im doing wrong.
the checker page's php edit: added if statement doesnt post blank going page:
<?php if(isset($_post['e']) && isset($_post['p'])){ $e = @$_post['e']; $p = @$_post['p']; $url = 'myapi.php?e='.$e.'&p='.$p; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36 (khtml, gecko) chrome/39.0.2171.95 safari/537.36'); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_followlocation, 1); $page = curl_exec($ch); $haystack = $page; $needle = 'profilesgatewrapper'; if(strpos($needle, $haystack) !== true) { file_put_contents('working.txt','test', file_append); } else { echo $page; } } ?>
myapi.php:
<?php $email=$_get['e']; $pass=$_get['p']; $url='https://signup.netflix.com/login'; //https $cookie="cookie.txt"; $ch2 = curl_init(); curl_setopt ($ch2, curlopt_url, $url); curl_setopt ($ch2, curlopt_ssl_verifypeer, false); curl_setopt ($ch2, curlopt_useragent, "mozilla/5.0 (windows nt 6.1) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.64 safari/537.31"); curl_setopt ($ch2, curlopt_timeout, 60); curl_setopt($ch2, curlopt_ssl_verifyhost, false); curl_setopt ($ch2, curlopt_followlocation, 1); curl_setopt ($ch2, curlopt_returntransfer, 1); curl_setopt ($ch2, curlopt_cookiejar, $cookie); curl_setopt ($ch2, curlopt_referer, $url); $result2 = curl_exec ($ch2); curl_close($ch2); $expa=explode('name="authurl" value="',$result2); $expb=explode('"/>',$expa[1]); $auth=$expb[0]; //$postdata = "email=".urlencode($email)."&password=".$pass."&authurl=".urlencode($auth).'&rememberme=false'; $postdata = http_build_query( array('email' => urlencode($email), 'password' => $pass, 'authurl' => urlencode($auth))); $postdata = http_build_query( array('email' => $email, 'password' => $pass, 'authurl' => $auth, 'rememberme' => '')); $ch = curl_init(); curl_setopt ($ch, curlopt_url, $url); curl_setopt ($ch, curlopt_ssl_verifypeer, false); curl_setopt ($ch, curlopt_useragent, "mozilla/5.0 (windows nt 6.1) applewebkit/537.31 (khtml, gecko) chrome/26.0.1410.64 safari/537.31"); curl_setopt ($ch, curlopt_timeout, 60); curl_setopt($ch, curlopt_ssl_verifyhost, false); curl_setopt ($ch, curlopt_followlocation, 1); curl_setopt ($ch, curlopt_returntransfer, 1); curl_setopt ($ch, curlopt_cookiefile, $cookie); curl_setopt ($ch, curlopt_cookiejar, $cookie); curl_setopt ($ch, curlopt_referer, $url); curl_setopt ($ch, curlopt_postfields, $postdata); curl_setopt ($ch, curlopt_post, 1); $result = curl_exec ($ch); echo $result; curl_close($ch); ?>
i have tried combinations of strpos's !== , === etc along true , falses none work.
why looking profilesgatewrapper because see in html when logged in.
when type var_dump($page); right after $page , enter in email , pass shows me page when logged in theres no issue curl.
my objective identify if logged in , if logged in file_put_content email:password : inbetween them working.txt file , else statement if wasnt found email:pass invalid.txt. not working me ive been @ 2 hours please help.
i think want is
if(strpos($needle, $haystack) !== false) { // means not found echo $page; } else { // means strpos returns integer (the position of occurrence) file_put_contents('working.txt','test', file_append); }
the strpos not return true
.
Comments
Post a Comment