Hvordan får jeg hentet brugere fra arto.
<?phpdo_everything("xxxx", "xxxxx", "female", "12", "13", "
");
function do_everything($username, $password, $sex, $minage, $maxage, $message, $status="--Alle--", $location="--Alle--")
{
@unlink("cookies.txt");
$users = get_online($username, $password, $sex, $minage, $maxage, $status, $location);
$ucount = count($users)-1;
$nada = print("$ucount users collected total.\n");
foreach ($users as $user)
{
if (strlen($user) > 2) { send_message(trim($user), $message); }
}
}
// martin's
// 4344247
// ea1e100dc9e7bebb810985e37875de38
// adam's
// 4470485
// ea1e100dc9e7bebb810985e37875de38
function send_message($user, $message, $myid=4738394, $mykey="ea1e100dc9e7bebb810985e37875de38")
{
@$old = file_get_contents("arto_sent.txt") or $old = NULL;
$user = trim($user);
$message = urlencode($message);
$message = str_replace("+", "%20", $message);
if (strrpos($old, $user)) { print("Skipping $user, they've already been messaged.\n"); return; }
sleep(5);
print "Sending a message to $user: ";
$ch = curl_init("http://www.arto.dk/brugere/gaestebog/skriv.asp?id=$user&brugernavn=SabrinaWJ");
$postdata = "destinationFejl=&destinationOK=&verificationUserID=$myid&verificationKey=$mykey&beskrivelse=$message";
$c = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$c = curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$c = curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
$c = curl_setopt($ch, CURLOPT_HEADER, 1);
$c = curl_setopt($ch, CURLOPT_POST, 1);
$c = curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$x = curl_exec($ch);
if (strpos($x, "default.asp?id=$user"))
{
print("Success\n");
$new = $old.$user."\n";
file_put_contents("arto_sent.txt", $new);
} else {
$new = $old.$user."\n";
file_put_contents("arto_sent.txt", $new);
print("Failed!\n");
}
}
function do_login($username, $password)
{
print "Attempting to login with $username: ";
$ch = curl_init("http://arto.dk/r3/frames/navigation.asp");
$postdata = "action=submit&brugernavn=$username&kodeord=$password&AutoLogin=Ja&loginKnap=Log+ind";
$c = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$c = curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$c = curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
$c = curl_setopt($ch, CURLOPT_HEADER, 1);
$c = curl_setopt($ch, CURLOPT_POST, 1);
$c = curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$x = curl_exec($ch);
if (strpos($x, "LoggetInd=1"))
{
// success
print "Success\n";
} else {
// failed
print "Failed\n";
return;
}
}
function get_online($user, $pass, $sex, $minage, $maxage, $status="--Alle--", $location="--Alle--")
{
do_login($user, $pass);
$status = get_status($status);
$location = get_location($location);
$ret = NULL;
$start = 18;
for ($i = 1; $i < 50; $i++)
{
print("Getting online list, page $i\n");
$ch = curl_init("http://www.arto.dk/section/user/onlinelist/Default.aspx");
$c = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$c = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$c = curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
$c = curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
$x = curl_exec($ch);
$x = str_replace(">", ">\n", $x);
$ef = preg_replace('|<input type="hidden" name="__EVENTFORMID" id="__EVENTFORMID" value="(.+?)" />|', '<xxx>$1<xxx>', $x);
$ef = split("<xxx>", $ef);
$ef = $ef[1];
$vs = preg_replace('|<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)" />|', '<xxx>$1<xxx>', $x);
$vs = split("<xxx>", $vs);
$vs = $vs[1];
$vs = urlencode($vs); $ef = urlencode($ef);
//$postdata = "__EVENTFORMID=$ef&__EVENTTARGET=ctl00%24Main%24PageBar2&__EVENTARGUMENT=$i&__VIEWSTATE=$vs&GenderDropDownList=$sex&ctl00%24Main%24CivilStatusDropDownList=$status&ctl00%24Main%24MinAgeDropDownList=$minage&ctl00%24Main%24MaxAgeDropDownList=$maxage&ctl00%24Main%24RegionDropDownList=$location&ctl00%24Main%24SearchButton=S%F8g";
$postdata = "__EVENTFORMID=$ef&__EVENTTARGET=ctl00%24ctl00%24Main%24Main%24PageBar2&__EVENTARGUMENT=$i&";
$postdata .= "__VIEWSTATE=$vs&ctl00%24ctl00%24Main%24Main%24GenderDropDownList=$sex&";
$postdata .= "ctl00%24ctl00%24Main%24Main%24CivilStatusDropDownList=$status&";
$postdata .= "ctl00%24ctl00%24Main%24Main%24MinAgeDropDownList=$minage&";
$postdata .= "ctl00%24ctl00%24Main%24Main%24MaxAgeDropDownList=$maxage&";
$postdata .= "ctl00%24ctl00%24Main%24Main%24RegionDropDownList=$location";
/*
$postdata = "__EVENTFORMID=$ef&__EVENTTARGET=ctl00%24Main%24PageBar2&__EVENTARGUMENT=$i";
$postdata .= "&__VIEWSTATE=$vs&ctl00%24Main%24GenderDropDownList=$sex&ctl00%24Main%24CivilStatusDropDownList=$status";
$postdata .= "&ctl00%24Main%24MinAgeDropDownList=$minage&ctl00%24Main%24MaxAgeDropDownList=$maxage&ctl00%24Main%24RegionDropDownList=$location";
*/
$c = curl_setopt($ch, CURLOPT_HEADER, 1);
$c = curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
$c = curl_setopt($ch, CURLOPT_POST, 1);
$c = curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$x = curl_exec($ch);
$check = $x;
for ($a = 0; $a < 5; $a++)
{
$check = str_replace(chr(10), "", $check);
$check = str_replace(chr(13), "", $check);
$check = str_replace("\n", "", $check);
$check = str_replace(" ", " ", $check);
$check = str_replace(" ", " ", $check);
$check = str_replace(" ", " ", $check);
$check = str_replace("\t", "", $check);
}
if (!strpos($check, "<b> $i </b>")) { print("No results.\n"); $ret = split("\n", $ret); return array_unique($ret); }
//if (!strpos($check, "<b> $i </b>")) { print("No results.\n"); $ret = split("\n", $ret); return array_unique($ret); }
$c = curl_close($ch);
$x = preg_replace('|id=(.+?)" target|', '<xxx>$1<xxx>', $x);
$x = split("<xxx>", $x);
foreach ($x as $user)
{
$user = intval($user);
if ($user > 100) { $ret .= "$user\n"; }
}
}
$ret = split("\n", $ret);
return array_unique($ret);
}
function get_status($status1)
{
$status1 = str_replace("#230;", "�", $status1);
switch ($status1)
{
case "--Alle--":
$stat = 0;
break;
case "Ikke angivet":
$stat = 1;
break;
case "Gift":
$stat = 2;
break;
case "Kæreste":
$stat = 3;
break;
case "Netkæreste":
$stat = 4;
break;
case "Single":
$stat = 6;
break;
case "Samlever":
$stat = 7;
break;
case "Forlovet":
$stat = 8;
break;
default:
$stat = 0;
break;
}
return $stat;
}
function get_location($location1)
{
switch ($location1)
{
case "Esbjerg":
$loc1 = 2;
break;
case "Frederiksberg":
$loc1 = 4;
break;
case "Fyn":
$loc1 = 3;
break;
case "F�r�erne":
$loc1 = 5;
break;
case "Gr�nland":
$loc1 = 6;
break;
case "Ikke angivet":
$loc1 = 0;
break;
case "K�benhavn":
$loc1 = 7;
break;
case "Lolland/Falster":
$loc1 = 8;
break;
case "Midtjylland":
$loc1 = 9;
break;
case "Nordjylland":
$loc1 = 10;
break;
case "Odense":
$loc1 = 11;
break;
case "Sj�lland":
$loc1 = 12;
break;
case "S�nderjylland":
$loc1 = 13;
break;
case "Udlandet":
$loc1 = 16;
break;
case "Vestjylland":
$loc1 = 18;
break;
case "�stjylland":
$loc1 = 17;
break;
case "Aalborg":
$loc1 = 15;
break;
case "�rhus":
$loc1 = 14;
break;
default:
$loc1 = 0;
break;
}
return $loc1;
}
?>
Ovenfor er sourcecoden til et script jeg bruger til at lave pr på arto.
Det henter alle onlinebrugere fra http://arto.com/section/user/onlinelist/
og sender dem et gæstebogsindlæg.
Sagen er den at jeg meget gerne vil have det ændret så det i stedet for at sende til alle online sender til alle på min venneliste:
http://arto.com/section/user/profile/friends/default.aspx?id=4868680
Håber du kan korrigerer scriptet så det virker. Burde ikke være meget der skulle ændres.
Vh
Martin
