PHP Classes

Orkut grabber not working..

Recommend this page to a friend!

      Contact Grabber  >  All threads  >  Orkut grabber not working..  >  (Un) Subscribe thread alerts  
Subject:Orkut grabber not working..
Summary:Orkut grabber not working..
Messages:8
Author:Habeeb
Date:2008-11-17 07:44:19
Update:2010-01-01 16:16:43
 

  1. Orkut grabber not working..   Reply   Report abuse  
Picture of Habeeb Habeeb - 2008-11-17 07:44:20
Orkut grabber not working, any idea?

  2. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of Upo Upo - 2008-11-21 06:49:52 - In reply to message 1 from Habeeb
yes its not working for me either :o(

But I found another free script and its working

Regards
Upeksha

  3. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of Habeeb Habeeb - 2008-12-04 07:45:59 - In reply to message 2 from Upo
Could you share that free script source?

  4. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of Upo Upo - 2008-12-09 10:36:22 - In reply to message 3 from Habeeb
ya sure...

Try OpenInviter (google it )

  5. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of Sanal.k Sanal.k - 2009-06-10 05:58:51 - In reply to message 4 from Upo
<?php

//Hi All try out this code.



require_once('baseclass/baseclass.php');

class orkut extends baseFunction
{
var $dir_path = "";
var $error_msg = "";
var $fileName ="";

function grabOrkut()
{
require_once('baseclass/config.php');
$this->dir_path = $DIR_PATH;
$this->error_msg = $ERROR_LOGIN;
}

function getAddressbook($YOUR_EMAIL,$YOUR_PASSWORD)
{

//echo "hi...am from orkut";
#the globals will be updated/used in the read_header function
global $location;
global $cookiearr;
global $ch;

#initialize the curl session
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.orkut.co.in/Home.aspx");
curl_setopt($ch, CURLOPT_REFERER, "");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADERFUNCTION, array($this, 'read_header'));
curl_setopt($ch, CURLOPT_HEADER, 1);

#get the html from gmail.com
$html = curl_exec($ch);

$matches = array();
$actionarr = array();

$action = "https://www.google.com/accounts/ServiceLoginAuth?service=orkut";

#parse the login form:
#parse all the hidden elements of the form
preg_match_all('/<input type\="hidden" name\="([^"]+)".*?value\="([^"]*)"[^>]*>/si', $html, $matches);
$values = $matches[2];
$params = "";

$i=0;
foreach ($matches[1] as $name)
{
$params .= "$name=" . urlencode($values[$i]) . "&";
++$i;
}

$login = urlencode($YOUR_EMAIL);
$password = urlencode($YOUR_PASSWORD);


function load($url,$options=array()) {
$default_options = array(
'method' => 'get',
'return_info' => false,
'return_body' => true,
'cache' => false,
'referer' => '',
'headers' => array(),
'session' => false,
'session_close' => false,
);
// Sets the default options.
foreach($default_options as $opt=>$value) {
if(!isset($options[$opt])) $options[$opt] = $value;
}

$url_parts = parse_url($url);
$ch = false;
$info = array(//Currently only supported by curl.
'http_code' => 200
);
$response = '';

$send_header = array(
'Accept' => 'text/*',
'User-Agent' => 'BinGet/1.00.A (http://www.bin-co.com/php/scripts/load/)'
) + $options['headers']; // Add custom headers provided by the user.

if($options['cache']) {
$cache_folder = '/tmp/php-load-function/';
if(isset($options['cache_folder'])) $cache_folder = $options['cache_folder'];
if(!file_exists($cache_folder)) {
$old_umask = umask(0); // Or the folder will not get write permission for everybody.
mkdir($cache_folder, 0777);
umask($old_umask);
}

$cache_file_name = md5($url) . '.cache';
$cache_file = joinPath($cache_folder, $cache_file_name); //Don't change the variable name - used at the end of the function.

if(file_exists($cache_file)) { // Cached file exists - return that.
$response = file_get_contents($cache_file);

//Seperate header and content
$separator_position = strpos($response,"\r\n\r\n");
$header_text = substr($response,0,$separator_position);
$body = substr($response,$separator_position+4);

foreach(explode("\n",$header_text) as $line) {
$parts = explode(": ",$line);
if(count($parts) == 2) $headers[$parts[0]] = chop($parts[1]);
}
$headers['cached'] = true;

if(!$options['return_info']) return $body;
else return array('headers' => $headers, 'body' => $body, 'info' => array('cached'=>true));
}
}

///////////////////////////// Curl /////////////////////////////////////
//If curl is available, use curl to get the data.
if(function_exists("curl_init")
and (!(isset($options['use']) and $options['use'] == 'fsocketopen'))) { //Don't use curl if it is specifically stated to use fsocketopen in the options

if(isset($options['post_data'])) { //There is an option to specify some data to be posted.
$page = $url;
$options['method'] = 'post';

if(is_array($options['post_data'])) { //The data is in array format.
$post_data = array();
foreach($options['post_data'] as $key=>$value) {
$post_data[] = "$key=" . urlencode($value);
}
$url_parts['query'] = implode('&', $post_data);

} else { //Its a string
$url_parts['query'] = $options['post_data'];
}
} else {
if(isset($options['method']) and $options['method'] == 'post') {
$page = $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'];
} else {
$page = $url;
}
}

if($options['session'] and isset($GLOBALS['_binget_curl_session'])) $ch = $GLOBALS['_binget_curl_session']; //Session is stored in a global variable
else $ch = curl_init($url_parts['host']);

curl_setopt($ch, CURLOPT_URL, $page) or die("Invalid cURL Handle Resouce");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //Just return the data - not print the whole thing.
curl_setopt($ch, CURLOPT_HEADER, true); //We need the headers
curl_setopt($ch, CURLOPT_NOBODY, !($options['return_body'])); //The content - if true, will not download the contents. There is a ! operation - don't remove it.
if(isset($options['method']) and $options['method'] == 'post' and isset($url_parts['query'])) {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $url_parts['query']);
}
//Set the headers our spiders sends
curl_setopt($ch, CURLOPT_USERAGENT, $send_header['User-Agent']); //The Name of the UserAgent we will be using ;)
$custom_headers = array("Accept: " . $send_header['Accept'] );
if(isset($options['modified_since']))
array_push($custom_headers,"If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T',strtotime($options['modified_since'])));
curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers);
if($options['referer']) curl_setopt($ch, CURLOPT_REFERER, $options['referer']);

curl_setopt($ch, CURLOPT_COOKIEJAR, "/tmp/binget-cookie.txt"); //If ever needed...
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

if(isset($url_parts['user']) and isset($url_parts['pass'])) {
$custom_headers = array("Authorization: Basic ".base64_encode($url_parts['user'].':'.$url_parts['pass']));
curl_setopt($ch, CURLOPT_HTTPHEADER, $custom_headers);
}

$response = curl_exec($ch);
$info = curl_getinfo($ch); //Some information on the fetch

if($options['session'] and !$options['session_close']) $GLOBALS['_binget_curl_session'] = $ch; //Dont close the curl session. We may need it later - save it to a global variable
else curl_close($ch); //If the session option is not set, close the session.

//////////////////////////////////////////// FSockOpen //////////////////////////////
} else { //If there is no curl, use fsocketopen - but keep in mind that most advanced features will be lost with this approch.
if(isset($url_parts['query'])) {
if(isset($options['method']) and $options['method'] == 'post')
$page = $url_parts['path'];
else
$page = $url_parts['path'] . '?' . $url_parts['query'];
} else {
$page = $url_parts['path'];
}

if(!isset($url_parts['port'])) $url_parts['port'] = 80;
$fp = fsockopen($url_parts['host'], $url_parts['port'], $errno, $errstr, 30);
if ($fp) {
$out = '';
if(isset($options['method']) and $options['method'] == 'post' and isset($url_parts['query'])) {
$out .= "POST $page HTTP/1.1\r\n";
} else {
$out .= "GET $page HTTP/1.0\r\n"; //HTTP/1.0 is much easier to handle than HTTP/1.1
}
$out .= "Host: $url_parts[host]\r\n";
$out .= "Accept: $send_header[Accept]\r\n";
$out .= "User-Agent: {$send_header['User-Agent']}\r\n";
if(isset($options['modified_since']))
$out .= "If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T',strtotime($options['modified_since'])) ."\r\n";

$out .= "Connection: Close\r\n";

//HTTP Basic Authorization support
if(isset($url_parts['user']) and isset($url_parts['pass'])) {
$out .= "Authorization: Basic ".base64_encode($url_parts['user'].':'.$url_parts['pass']) . "\r\n";
}

//If the request is post - pass the data in a special way.
if(isset($options['method']) and $options['method'] == 'post' and $url_parts['query']) {
$out .= "Content-Type: application/x-www-form-urlencoded\r\n";
$out .= 'Content-Length: ' . strlen($url_parts['query']) . "\r\n";
$out .= "\r\n" . $url_parts['query'];
}
$out .= "\r\n";

fwrite($fp, $out);
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
}
}



//Get the headers in an associative array
$headers = array();

if($info['http_code'] == 404) {
$body = "";
$headers['Status'] = 404;
} else {
//Seperate header and content
$header_text = substr($response, 0, $info['header_size']);
$body = substr($response, $info['header_size']);

foreach(explode("\n",$header_text) as $line) {
$parts = explode(": ",$line);
if(count($parts) == 2) $headers[$parts[0]] = chop($parts[1]);
}
}

if(isset($cache_file)) { //Should we cache the URL?
file_put_contents($cache_file, $response);
}

if($options['return_info']) return array('headers' => $headers, 'body' => $body, 'info' => $info, 'curl_handle'=>$ch);
return $body;
}





$contents = load('https://www.google.com/accounts/ServiceLoginAuth?service=orkut');
$options1 = array(
'return_info' => true,
'method' => 'post'
);

$res = load('https://www.google.com/accounts/ServiceLoginAuth?service=orkut',$options1);


$nav = $res['headers']['Set-Cookie'];
$gal = explode(';Path=/',$nav);
$galax = $gal[0];


$login1 = $YOUR_EMAIL;
$login2 = explode('@',$login1);
$login = $login2[0];
$password = urlencode($YOUR_PASSWORD);

$s = $_SERVER['HTTP_COOKIE'];
$s1 = explode('; __utmb=',$s);
$s2 =$s1[0];
$s3 = explode('.',$s2);
$s4 = $s3[2]; //Final HTTP_COOKIE value.


//Function to generate random numbers.
function ran()
{
$chars = '0123456789';
$length = 3;

$max_i = strlen($chars)-1;
$value = '';
for ($i=0;$i<$length;$i++)
{
$value .= $chars{mt_rand(0,$max_i)};
}
return $value;

}


//Concatinating HTTP_COOKIE value with random numbers.

$al = $s4.ran();
$a2 = $s4.ran();
$a3 = $s4.ran();

$p1 = "http://www.orkut.com/RedirLogin.aspx?msg=0&ts=$al:$a2:$a3";
$p2 = urlencode($p1);
$p3 = "continue=".$p2."&service=orkut&cd=IN&skipvpage=true&sendvemail=false&rm=false&hl=en-US&$galax&Email=$login&Passwd=$password&rmShown=1&signIn=Sign+in";

#submit the login form:
curl_setopt($ch, CURLOPT_URL,$action);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $p3);//&PersistentCookie="
curl_setopt($ch, CURLOPT_HEADER, 1);
$html = curl_exec($ch);


if (preg_match('/url=([^"]*)/', $html, $actionarr)!=0)
{
$location = $actionarr[1];
}
else
{
return 1;
}

$location;

$location = str_replace("&quot;", '', $location);
$location = str_replace("&amp;", '&', $location);
$location = str_replace("&#39;","&nbsp;",trim($location,"'\""));

$fp = fopen("cookie.txt", "w+");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$html = curl_exec($ch);

//$location = str_replace("&quot;", '', $location);
//$location = str_replace("&amp;", '&', $location);
//$location = trim ($location,"'\"");

$exp = explode('&continue=http%3A%2F%2F',$location);
$exp2 =str_replace("'"," ",$exp[1] );

$location = urldecode($exp2);
$location = str_replace("&#39;","&nbsp;",trim($location,"'\""));
$loc=$location;



$fp = fopen("cookie.txt", "w+");
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$h = curl_exec($ch);


$ork_cookie = explode("orkut_state=",$h);
$orkut_cookie = split(";",$ork_cookie[1]);
$orkut_state_old = "orkut_state=".$ork_cookie[1]; //Orkut state fetching wrong cookie. i,e incomplete cookie

$o1 = explode('S=neworkut_borg=',$orkut_state_old);
$o2 = $o1[1];
$o3 = explode('; Path=/;',$o2);
$o4 = $o3[0];
$s = "S=neworkut_borg=".$o4; //Second cookie.


$orkut_state1 = "orkut_state=".$ork_cookie[1];
$orkut_state2 = explode('Domain=www.orkut.com;',$orkut_state1);
$orkut_state = $orkut_state2[0]; //."=:" //First cookie.

$location = "http://www.orkut.co.in/ShowFriends.aspx?rl=fpm"; //New url.
#follow the location specified after login

curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, $location);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_COOKIE,"$orkut_state; $s;");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,false);

$html = curl_exec($ch);

$regexp = "showing <B>[^<]*<\/b> of <b>(.*?)<\/b>";
preg_match_all("/$regexp/s", $html, $matches);
$noOfContacts = $matches[1][0];

$noOfPages = ceil(($noOfContacts / 20)); //find out the no of pages of friends
$handle = fopen("cookie.txt", "w+");
for ($i = 1 ; $i <= $noOfPages ; $i++)
{

$friendsPage = "http://www.orkut.co.in/ShowFriends.aspx?show=all&pno=$i";
$html = "";

$ch6 = "";
$ch6 = curl_init();
curl_setopt($ch6, CURLOPT_URL, $friendsPage);

curl_setopt($ch6, CURLOPT_REFERER, true);
curl_setopt($ch6, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch6, CURLOPT_HEADER, true);
curl_setopt($ch6, CURLOPT_COOKIE,"$orkut_state; $s;");


$html = curl_exec($ch6);
fwrite($handle,$html);


/*$friendsArray = array(); //this is the array for friends listing. We initialize it to NULL everytime
$friendsArray = explode('<h3 class="smller">',$html);
$firstElement = array_shift($friendsArray); //arrayshif used for remove the upper part of the array in the friend list

foreach($friendsArray as $key=>$value)
{
$arr = explode('</h3>', $value);

$username = strip_tags($arr[0]);//striptags used for remove the a href in the name

$emailE = explode('<div class="nor" >', $value);
@$emailE = explode('<br>', $emailE[1]);

$emails = $emailE[0];
$domain = strstr($emails,"@");

if(isset($domain) && !empty($domain))
{
echo '<li>'.$result['name'][]=$username;
echo '<li>'.$result['email'][]=$emails;
}
}*/

function makeClickableLinks($text)
{
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

'<a href="\\1" target="_blank">\\1</a>', $text);

$text = eregi_replace('(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',

'\\1<a href="http://\\2" target="_blank">\\2</a>', $text);

$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',

'<a href="mailto:\\1" target="_blank">\\1</a>', $text);

return $text;
}


$html = str_replace("\n","",$html);
$friendsArray = array(); //this is the array for friends listing. We initialize it to NULL everytime
$friendsArray = explode('_editUser',$html);
$firstElement = array_shift($friendsArray); //arrayshif used for remove the upper part of the array in the friend list

foreach($friendsArray as $key=>$value)
{
$value;
$p1 = explode(';FriendGroupsSection',$value);
$p2 = makeClickableLinks($p1[0]);
$fp1 = fopen('names.txt',"a+");
fwrite($fp1,$p2);
fclose($fp1);

}


$filename = "path/names.txt"; //Change path when uploading.
$newfile = @fopen($filename, "r") or exit("Could not open file");
$file_contents = @fread($newfile, filesize($filename)) or exit("Could not read file contents");
fclose($newfile);
$friendsemail = array(); //this is the array for friends listing. We initialize it to NULL everytime
$friendsemail = explode('target="_blank">',$file_contents);
$firstElement = array_shift($friendsemail); //arrayshif used for remove the upper part of the array in the friend list

foreach($friendsemail as $key1=>$value1)
{
$value1;
$value2 = explode('</a>',$value1);
$result['email'][] = $value2[0];

$name1 = explode('@',$value2[0]);
$result['name'][] = $name1[0];
}


if (file_exists("path/names.txt")) //Change path when uploading.
{
unlink("path/names.txt/names.txt"); //Change path when uploading.
}
else {
echo "Sorry could not delete";
}


}
return $result;
}
}



?>

  6. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of Mandakini Mandakini - 2009-07-27 15:23:42 - In reply to message 5 from Sanal.k
Hi

Its mot working for orkut,hotmail and rediffmail.com

  7. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of Vishal Vishal - 2009-12-28 11:00:30 - In reply to message 5 from Sanal.k
hi I don't have baseclass.php please send it to ksagarvishal@gmail.com

  8. Re: Orkut grabber not working..   Reply   Report abuse  
Picture of senol senol - 2010-01-01 16:16:43 - In reply to message 7 from Vishal
pls helps

image msg

irannewspapersonline.com/muslimgrou ...