note 49435 added to ref.curl

From: Date: Thu, 27 Jan 2005 20:51:53 +0000
Subject: note 49435 added to ref.curl
Groups: php.notes 
Request: Send a blank email to php-notes+get-84087@lists.php.net to get a copy of this message
I did this script to login to a community X number of times <?php $url = ’[the script that handle logins]’; if (empty($_GET[’u’]) && empty($_GET[’p’]) && empty($_GET[’x’])){ echo "<FORM NAME=’make’ METHOD=’get’ ACTION=’".$_SERVER[’PHP_SELF’]."’> ".$url."?u=’<INPUT TYPE=’text’ NAME=’u’ value=’nickname’>’ &p=’<INPUT TYPE=’text’ NAME=’p’ value=’password’>’ &x=’<INPUT TYPE=’text’ NAME=’x’ value=’times’>’ <input type=’submit’>"; }else{ if(!intval($_GET[’x’])) $_GET[’x’] = 10; $time=time(); $params = "username=".$_GET[’u’]."&userpass=".urldecode($_GET[’p’]); $count = login($url,$params); echo $count."/".$_GET[’x’]." logins tog ".(time() - $time)." sekunder"; } // function login($url,$params){ $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); $cnt=0; for($i=0;$i<($_GET[’x’]);$i++){ if(curl_exec ($ch))$cnt++; } curl_close ($ch); return $cnt; } ?> ---- Manual Page -- http://www.php.net/manual/en/ref.curl.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+49435 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49435&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49435&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49435&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49435&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49435&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+49435&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#84087) next »