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 '
;
}
?>