Welcome to Dream.In.Code
Click Here
Getting Help is Easy!

Join 117,523 Programmers for FREE! Ask your question and get quick answers from experts. There are 2,017 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Need Some translation here....

 
Reply to this topicStart new topic

Need Some translation here....

webb315
post 27 Jun, 2008 - 02:07 PM
Post #1


New D.I.C Head

*
Joined: 27 Jun, 2008
Posts: 1

Can any One Translate my PHP Code To Python?
Its A Small Piece of code. i was not sure where to post but its related to web programming. So i m posting here. If its worth any price then i might b able to pay for this too. Here is the code:

CODE
<?php
function Vote() {
function curl($a,$b,$c,$d,$e){
   $ch = curl_init();
      curl_setopt_array($ch,
         array(
            CURLOPT_URL => $a,
            CURLOPT_RETURNTRANSFER => $b,
            CURLOPT_COOKIE => $c,
            CURLOPT_HEADER => $d,
            CURLOPT_NOBODY => $d,
            CURLOPT_CUSTOMREQUEST => ($e)?"POST":"GET",
            CURLOPT_POSTFIELDS => $e
         )
      );
   $g = curl_exec($ch);
   curl_close($ch);
   return $g;
}

$number = range($_POST['nf'],$_POST['nl']);

$email1 = $_POST['email1'];
$email3 = $_POST['email3'];
$senha = $_POST['senha'];
$o = "http://www.orkut.com/";
$g = "https://www.google.com/accounts/ClientLogin?Email=";
$link = $_POST['link_vote'];
$option = $_POST['option'];
$cmm = $_POST['cmm'];

for($i=0;$i<count($number);$i++){

$n = $number[$i];
$l = $email1;
$z = $email3;
$p = $senha;

$r = curl($g.$email1.$n.$email3."&Passwd=$p&skipvpage=true&service=orkut",1,0,0,null);
preg_match_all("/Auth=(.*)/i",$r,$r);
$auth=$r[1][0];

$r = curl($o."RedirLogin.aspx?auth=$auth",1,0,1,null);
preg_match_all("/orkut_state=ORKUTPREF.*/i",$r,$r);
$cookie=$r[0][0];

$r = curl($o."scrapbook.aspx",1,$cookie,0,null);
preg_match_all("/value\=\"([^\"]{28,32})\"/i",$r,$r);
$postsig= "POST_TOKEN=".$r[1][0]."&signatureto=".rawurlencode($r[1][1]);

$join  = "http://www.orkut.com/CommunityJoin.aspx?cmm=".$cmm;
$PTSG = $postsig."&Action.join";
$r = curl($join,1,$cookie,1,$PTSG);

$VoEnQ = $link;
$r = curl($VoEnQ,1,$cookie,1,$postsig."&option=".$option."&public_vote=2&Action.vote");

print_r("Joined And Voted in Community <b>".$cmm."</b><br>");

flush();
sleep(2);
};
}
    if(isset($_POST['link_vote'])){
     Vote();
    }else{ echo '
;
}
?>
User is offlineProfile CardPM

Go to the top of the page


linuxunil
post 27 Jun, 2008 - 04:22 PM
Post #2


New D.I.C Head

Group Icon
Joined: 7 Mar, 2006
Posts: 46



Thanked 2 times

Dream Kudos: 125
My Contributions


QUOTE(webb315 @ 27 Jun, 2008 - 02:07 PM) *

Can any One Translate my PHP Code To Python?
Its A Small Piece of code. i was not sure where to post but its related to web programming. So i m posting here. If its worth any price then i might b able to pay for this too. Here is the code:

CODE
<?php
function Vote() {
function curl($a,$b,$c,$d,$e){
   $ch = curl_init();
      curl_setopt_array($ch,
         array(
            CURLOPT_URL => $a,
            CURLOPT_RETURNTRANSFER => $b,
            CURLOPT_COOKIE => $c,
            CURLOPT_HEADER => $d,
            CURLOPT_NOBODY => $d,
            CURLOPT_CUSTOMREQUEST => ($e)?"POST":"GET",
            CURLOPT_POSTFIELDS => $e
         )
      );
   $g = curl_exec($ch);
   curl_close($ch);
   return $g;
}

$number = range($_POST['nf'],$_POST['nl']);

$email1 = $_POST['email1'];
$email3 = $_POST['email3'];
$senha = $_POST['senha'];
$o = "http://www.orkut.com/";
$g = "https://www.google.com/accounts/ClientLogin?Email=";
$link = $_POST['link_vote'];
$option = $_POST['option'];
$cmm = $_POST['cmm'];

for($i=0;$i<count($number);$i++){

$n = $number[$i];
$l = $email1;
$z = $email3;
$p = $senha;

$r = curl($g.$email1.$n.$email3."&Passwd=$p&skipvpage=true&service=orkut",1,0,0,null);
preg_match_all("/Auth=(.*)/i",$r,$r);
$auth=$r[1][0];

$r = curl($o."RedirLogin.aspx?auth=$auth",1,0,1,null);
preg_match_all("/orkut_state=ORKUTPREF.*/i",$r,$r);
$cookie=$r[0][0];

$r = curl($o."scrapbook.aspx",1,$cookie,0,null);
preg_match_all("/value\=\"([^\"]{28,32})\"/i",$r,$r);
$postsig= "POST_TOKEN=".$r[1][0]."&signatureto=".rawurlencode($r[1][1]);

$join  = "http://www.orkut.com/CommunityJoin.aspx?cmm=".$cmm;
$PTSG = $postsig."&Action.join";
$r = curl($join,1,$cookie,1,$PTSG);

$VoEnQ = $link;
$r = curl($VoEnQ,1,$cookie,1,$postsig."&option=".$option."&public_vote=2&Action.vote");

print_r("Joined And Voted in Community <b>".$cmm."</b><br>");

flush();
sleep(2);
};
}
    if(isset($_POST['link_vote'])){
     Vote();
    }else{ echo '
;
}
?>



You will have to show an attempt before anyone will help you. Also if your looking to pay some one to do it you would be better off posting on a coder for hire site such as rentacoder.com
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/7/08 03:35PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month