adv Posted October 17, 2008 Share Posted October 17, 2008 hello i`m having a problem that i just can`t seem to figure it out its start like this : i`m trying to get the content of 'file.txt' and what i wanna do is login with curl with the users and passwords from the 'file.txt' <?php //get the file with file() - its an array $file=file('file.txt'); ?> in file.txt i have its just an example in the file.txt user1:password1 user2:password2 // i`ve tried with for() and then using explode to get user and password separatly $file=file('file.txt'); for($i=0;$i<count($file);$i++){ $res=explode(':',$file[$i]); $LOGINURL = "http://www.phpfreaks.com/forums/index.php?action=login2"; // here at postfields i cant get it done // ived tried $res[0] for user and $res[1] for password $POSTFIELDS = 'user='.$res[0].'&passwrd='.$res[1].'&cookielength=-1&openid_url=&hash_passwrd='; $agent='Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3'; $cookie_file_path='cook.txt'; $reffer='http://phpfreaks.com/'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$LOGINURL); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTFIELDS); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_REFERER, $reffer); curl_setopt($ch, CURLOPT_COOKIE,$cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); $result = curl_exec ($ch); curl_close ($ch); //echo $result; if(stristr($result,'<li id="name">Hello')){ $match=strip_tags(substr($result,strpos($result,'<li id="name">Hello')+14,40)); } echo $match; } //its prints Hello adv Hello adv I want to achive : 1 - loop until it reached end of line; 2 - try all the users in the 'file.txt' file and echo message like Hello username Link to comment Share on other sites More sharing options...
Daniel0 Posted October 17, 2008 Share Posted October 17, 2008 Uh... dude, we only allow humans to login. Locked. Link to comment Share on other sites More sharing options...
Recommended Posts