function createChannel($email, $password, $tries = 0) { $this->userName = $email; $this->email = $email; $this->password = $password; $client = $this->getNewHttpClient($this->email, $this->password); $client->setCookieJar(); $client->setUri('https://accounts.google.com/ServiceLoginAuth'); $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); //echo ("Response 1:<br>"); //var_dump ( $response ); //echo ("<br><br><br>"); /* $doc = new DOMDocument(); $doc -> loadHTML($response); $xpath = new DOMXPath($doc); // get sign in button foreach ($xpath->query ( '//div[@id="yt-masthead-signin"]//button' ) as $node) { $signInUrl = $node -> getAttribute("href"); } //echo ("Sign in URL: $signInUrl<br><br>"); $client -> setUri($signInUrl); $clientResponse = $client -> request(Zend_Http_Client::POST); $response = $clientResponse -> getBody(); //echo ("Response 2:<br>"); //var_dump ( $response ); //echo ("<br><br><br>"); */ $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); // get Form action $action = ''; foreach ($xpath->query('//form[contains(@id,"gaia_loginform")]') as $node) { $action = $node->getAttribute("action"); } // echo ("Form submit = $action<br><br>"); $parameters = array("Email" => $this->email, "Passwd" => $this->password, "signIn" => "Sign in", "pstMsg" => "pstMsg", "dnConn" => "dnConn", "checkConnection" => "youtube:473:1", "checkedDomains" => "youtube"); // get all hidden inputs in form and add to parameters foreach ($xpath->query('//form[contains(@id,"gaia_loginform")]//input[contains(@type,"hidden")]') as $node) { $parameters[$node->getAttribute("name")] = $node->getAttribute("value"); } // echo ("Parameters:<br>"); // var_dump ( $parameters ); // echo ("<br><br>"); var_dump($parameters); echo "<br><bR>action: " . $action . "<br><br>"; $client->setUri($action); $client->setParameterPost($parameters); $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); echo "Response 3:<br>"; var_dump($response); echo "<br><br><br>"; die; $solved = false; $tries = 0; $deCaptcha = new DeCaptcha('frostbyte07', 'Neeuq011$'); do { // Solve Captcha $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); $src = null; foreach ($xpath->query('//img[contains(@alt,"Visual verification")]') as $node) { $src = $node->getAttribute("src"); } if (strlen($src) > 0) { if ($tries > 0) { $deCaptcha->reportLastCatchaIncorrect(); } //echo ("Solving captcha<br>"); $captchaText = $deCaptcha->getCatchaText($src); // echo ("Captcha Image: <img src='$src'><br>Text: // $captchaText<br><br>"); $parameters = array("toscaptcha" => $captchaText, "accept" => "I accept. Continue to my account."); // get all hidden inputs in form and add to parameters foreach ($xpath->query('//input[contains(@type,"hidden")]') as $node) { $parameters[$node->getAttribute("name")] = $node->getAttribute("value"); } // echo ("Parameters:<br>"); // var_dump ( $parameters ); // echo ("<br><br>"); $client->setParameterPost($parameters); $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); // echo ("Response 4:<br><pre>$response</pre>"); // echo ("<br><br><br>"); } else { //echo ("Captcha Solved<br>"); $solved = true; $accepted = true; $this->acceptedTOSClient = $client; //$this->storeResponse ( $response ); $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); $this->lastParameters = array(); // get all hidden inputs in form and add to parameters foreach ($xpath->query('//input[contains(@type,"hidden")]') as $node) { $this->lastParameters[$node->getAttribute("name")] = $node->getAttribute("value"); } } $tries++; } while (!$solved && $tries < 10); return $accepted; }
function acceptTOSForUser() { $accepted = false; // echo ("Gathered Username: $userName | Password: $password<br><br>"); $client = null; $tries = 2; while (!isset($client) && $tries > 0) { // $p = new Proxy ( ); // $p = $p->getRandomProxy (); $p = array("proxy" => null, "port" => null); $client = $this->getPlainHttpClient("http://www.youtube.com", $p['proxy'], $p['port']); $tries--; if (!isset($client)) { sleep(20); } } $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); //echo ("Response 1:<br>"); //var_dump ( $response ); //echo ("<br><br><br>"); $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); // get sign in button foreach ($xpath->query('//button[@id="masthead-user-button"]') as $node) { $signInUrl = $node->getAttribute("href"); } //echo ("Sign in URL: $signInUrl<br><br>"); $client->setUri($signInUrl); $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); //echo ("Response 2:<br>"); //var_dump ( $response ); //echo ("<br><br><br>"); $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); // get Form action foreach ($xpath->query('//form[contains(@id,"gaia_loginform")]') as $node) { $action = $node->getAttribute("action"); } // echo ("Form submit = $action<br><br>"); $parameters = array("Email" => $this->email, "Passwd" => $this->password, "signIn" => "Sign in", "service" => "youtube"); // get all hidden inputs in form and add to parameters foreach ($xpath->query('//input[contains(@type,"hidden")]') as $node) { $parameters[$node->getAttribute("name")] = $node->getAttribute("value"); } // echo ("Parameters:<br>"); // var_dump ( $parameters ); // echo ("<br><br>"); $client->setUri($action); $client->setParameterPost($parameters); $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); // echo ("Response 3:<br>"); // var_dump ( $response ); // echo ("<br><br><br>"); $solved = false; $tries = 0; $deCaptcha = new DeCaptcha('frostbyte07', 'Neeuq011$'); do { // Solve Captcha $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); $src = null; foreach ($xpath->query('//img[contains(@alt,"Visual verification")]') as $node) { $src = $node->getAttribute("src"); } if (strlen($src) > 0) { if ($tries > 0) { $deCaptcha->reportLastCatchaIncorrect(); } //echo ("Solving captcha<br>"); $captchaText = $deCaptcha->getCatchaText($src); // echo ("Captcha Image: <img src='$src'><br>Text: // $captchaText<br><br>"); $parameters = array("toscaptcha" => $captchaText, "accept" => "I accept. Continue to my account."); // get all hidden inputs in form and add to parameters foreach ($xpath->query('//input[contains(@type,"hidden")]') as $node) { $parameters[$node->getAttribute("name")] = $node->getAttribute("value"); } // echo ("Parameters:<br>"); // var_dump ( $parameters ); // echo ("<br><br>"); $client->setParameterPost($parameters); $clientResponse = $client->request(Zend_Http_Client::POST); $response = $clientResponse->getBody(); // echo ("Response 4:<br><pre>$response</pre>"); // echo ("<br><br><br>"); } else { //echo ("Captcha Solved<br>"); $solved = true; $accepted = true; $this->acceptedTOSClient = $client; //$this->storeResponse ( $response ); $doc = new DOMDocument(); $doc->loadHTML($response); $xpath = new DOMXPath($doc); $this->lastParameters = array(); // get all hidden inputs in form and add to parameters foreach ($xpath->query('//input[contains(@type,"hidden")]') as $node) { $this->lastParameters[$node->getAttribute("name")] = $node->getAttribute("value"); } } $tries++; } while (!$solved && $tries < 10); return $accepted; }
<?php error_reporting(0); $captchaFile = $_REQUEST['captcha']; // if (isset($captchaFile)) { //$captchaFile = urldecode($captchaFile); //echo("Captcha File: $captchaFile<br>"); require_once 'DeCaptcha.php'; $results = ''; $deCaptcha = new DeCaptcha('frostbyte07', 'Neeuq011$'); $balance = $deCaptcha->getBalance(); $results .= "Balance: {$balance} "; if ($balance > 0) { $results = $deCaptcha->getCatchaText($captchaFile); if (strlen($results) < 0) { $results = "Error: Couldn't not solve captcha"; $deCaptcha->reportLastCatchaIncorrect(); } } else { $results = "Error: No Balance Left To Solve Captcha"; } echo $results; } else { echo '<html><body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function solveCaptcha(){ $.ajax( { type :"GET", url :"DeCaptchaForm.php",