سكريبت بلغة PHP للتصويت لصورة الدرة في موقع MSNBC :
طريقة الاستخدام مثل أي ملف PHP .. فقط حدد عدد الأصوات التي تريد إعطائها للدرة في المتغيرة $count في أعلى الملف ثم قم بوضع الملف في دليل ويب الجذري لديك وقم بزيارته لمزودك ..
بالطبع الأداء سيكون أفضل بعشرات المرات إذا ركبته على مزود بعيد خاصة إذا كانت شركة في أمريكا حيث ستكون السرعة خارقة في التصويت .. هذا هو الملف :
كود:<?php // change this number to what you want .. // take into consideration the speed of you // connection and how much you love Mohammed // Al Dorra and make a decision $count = 100000; $start = time(); set_time_limit(0); ignore_user_abort(1); define("HTTP_AUTO",0); define("HTTP_HEAD",1); define("HTTP_GET",2); define("HTTP_POST",3); class Net_HTTP { var $host; var $port = 80; var $timeout = 30; var $path; var $method; var $get; var $post; var $cookie; var $auth; var $accept; var $referer; var $agent; var $code; var $header; var $content; var $parsed_header; var $returned_cookies; function get( $url, $timeout = 30 ) { $comp = parse_url($url); $this->setTimeout($timeout); $this->setHost($comp["host"]); $this->setPort($comp["port"]); $this->setPath($comp["path"]); $this->setGet($comp["query"]); if ($comp["user"] || $comp["pass"]) { $this->basicAuth($comp["user"],$comp["pass"]); } return $this->exec(); } function setTimeout( $timeout ) { $this->timeout = $timeout; } function setHost( $host ) { $this->host = $host; } function setPort( $port ) { $this->port = $port; } function setPath( $path ) { $this->path = $path; } function setGet( $query ) { if ($this->get) { $this->get .= "&"; } $this->get .= $query; } function addGet($name,$value) { if ($this->get) { $this->get .= "&"; } $this->get .= urlencode($name)."=".urlencode($value); } function addPost($name,$value) { if ($this->post) { $this->post .= "&"; } $this->post .= urlencode($name)."=".urlencode($value); } function addCookie($name,$value) { if ($this->cookie) { $this->cookie .= ";"; } /* According to netscapes recomendation the cookies that the server send to the client better be encoded using URL encoding, but they only to be decoded also by the server. This class working as an HTTP client has nothing to do with that and therfore the cookies will be sent as they are given by the class user without any change. Remember that they might be already encoded using URL encoding or any other type of encoding but the client doesn't deal with any of that. */ $this->cookie .= $name."=".$value; } function addGetList($list) { reset($list); while (list($name,$value) = each($list)) { $this->addGet($name,$value); } } function addPostList($list) { reset($list); while (list($name,$value) = each($list)) { $this->addPost($name,$value); } } function addAccept($type) { if ($this->accept) { $this->accept .= "\r\n"; } $this->accept .= "Accept: $type"; } function setUserAgent($ua) { $this->user_agent = "User-Agent: ".$ua; } function setReferer($ref) { $this->referer = $ref; } function basicAuth($username,$password) { $this->auth = "Basic ".base64_encode($username).":".base64_encode($password); } function exec() { if (!$this->timeout) { $this->timeout = 30; } if (!$this->port) { $this->port = 80; } if ($method == HTTP_AUTO) { if ($this->post) { $this->method = HTTP_POST; } else { $this->method = HTTP_GET; } } switch ($this->method) { case HTTP_GET: $header = "GET "; break; case HTTP_POST: $header = "POST "; break; case HTTP_HEAD: $header = "HEAD "; break; } if (!$this->path) { $this->path = '/'; } $header .= $this->path; if ($this->get) { $header .= "?".$this->get; } $header .= " HTTP/1.0\r\n"; $header .= "Host: $this->host\r\n"; if ($this->accept) { $header .= $this->accept."\r\n"; } if ($this->agent) { $header .= "User-Agent: ".$this->agent."\r\n"; } if ($this->cookie) { $header .= "Cookie: ".$this->cookie."\r\n"; } if ($this->auth) { $header .= "Authentication: ".$this->auth."\r\n"; } if ($this->referer) { $header .= "Referer: ".$this->referer."\r\n"; } if ($this->method == HTTP_POST) { $header .= "Content-type: application/x-www-form-urlencoded\r\n"; $header .= "Content-length: ".strlen($this->post)."\r\n"; $header .= "\r\n"; $header .= $this->post; } else { $header .= "\r\n"; } $fp = fsockopen($this->host, $this->port, &$errno, &$errmsg, $this->timeout); if (!$fp) { echo $errno; echo $errmsg; $success = false; } else { fputs ($fp, $header); while (!feof($fp)) { $response .= fgets ($fp,128); } fclose ($fp); $successs = true; } return $response; } function getReturnedCookies() { return $this->returned_cookies; } } for ($i=0;$i<$count;$i++) { /* Get a new guid */ $guidfetch = new Net_HTTP; $guid = $guidfetch->get("http://msid.msn.com/mps_id_sharing/redirect.asp?www.msnbc.com/news/create_p1.asp?URL=www.msnbc.com/modules/surveys/twip/yip_2000_readers_.asp"); $guid = preg_replace("/^((.|\n)*)newguid=([0-9A-Z]{32})((.|\n)*)$/","\\3",$guid); /* make that vote */ $gaza = new Net_HTTP; $gaza->addCookie("MC1","GUID=$guid"); $gaza->addCookie("P1","0"); $gaza->addPost("LVname","YIP_2000_readers_"); $gaza->addPost("author","D62CB0"); $gaza->addPost("Q1","40"); $gaza->setReferer("http://www.msnbc.com/modules/surveys/twip/yip_2000_readers_.asp"); $gaza->get("http://www.msnbc.com/modules/livevote/vote.asp"); } $period = time() - $start; echo "Made $count votes in $period seconds (average ".($count/$period)." vote/second)"; ?>



