Skip to content

Instantly share code, notes, and snippets.

@Mikulas
Created February 26, 2012 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mikulas/1918103 to your computer and use it in GitHub Desktop.
Save Mikulas/1918103 to your computer and use it in GitHub Desktop.
<?php
$username="username";
$password="password";
$cookie="cookie.txt";
$url_login = "https://login.comcast.net/login";
// login
$ch = curl_init($url_login);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_REFERER, $url_login);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=".$username."&passwd=".$password."&rm=2&deviceAuthn=false&forceAuthn=true&s=ccentral-cima&r=comcast.net&continue=http://xfinity.comcast.net/&lang=en&submit=sign_in");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_exec($ch);
curl_close($ch);
// get content
$ch = curl_init("http://xfinity.comcast.net/");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6");
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_REFERER, $url_login);
$result = curl_exec($ch);
curl_close($ch);
// work with $result freely
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment