Russia Posted November 9, 2009 Share Posted November 9, 2009 I have this script, it checks if an account information is valid or not, then says if it is or not. It is not working for some reason. By the way, make a free account here and check, I have my own private accounts to check with: https://secure.runescape.com/m=create/index.ws Or use this login information (DO NOT CHANGE THE PASSWORD TO BE AN ASSHOLE) Username: codingforums Password: donotchange THIS IS NOT ADVERTISING, THIS IS TO MAKE AN ACCOUNT TO SEE IF IT WORKS. Edit $username and $password to check after. If I put legit information into the $username and $password it says Invalid. But if i put fake information into $username and $password it also says invalid, which is correct. <?php $username = "username"; $password = "password"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://weblogin.runescape.com/login.ws"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "username=".$username."&password=".$password."&dest=title.ws&mod=www&ssl=0"); $pagedata = curl_exec($ch); curl_close($ch); if (preg_match("/Your login was successful. You will shortly be redirected to your destination./i", $pagedata)) { $valid = "Valid"; } elseif (preg_match("/Login Failed - Invalid Username or Password/i", $pagedata)) { $valid = "Invalid"; } else { $valid = "Cannot check! Too many invalid logins"; } echo $valid; ?> Does anyone notice the problem? Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/ Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 dude, take your username and password down, pronto .. not to rip into the integrity of anybody on this board, but you just never know. better to give out that kind of information (if at all), via private message or email, etc. EDIT: 'cause just writing, "DO NOT CHANGE THE PASSWORD TO BE AN ASSHOLE", is not enough to stop somebody from, well, changing your password. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954298 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 Nahh its okay its a brand new account, not even started tutorial island. Theres nothing on it basicly, and if someone does take it I can just recover with email address. Or you can make your own account. Also, can u see the problem? or an error in the coding? Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954299 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 do you need to hash the password before sending it via cURL? Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954301 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 nope. It worked a few days ago, and now it wont. >.> You can try whatever u want to make it work. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954306 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 something has changed, either on your end or theirs. starting with your end .. have you edited any code related to this cURL since it was last working? think hard. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954310 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 Nope, not at all. If you want to login the regular site, you can from here: https://secure.runescape.com/m=weblogin/loginform.ws?mod=www&ssl=0&dest=index.ws Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954313 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 <?php #credentials; $username = 'codingforums'; $password = 'donotchange'; #full URL; $feedUrl = 'https://weblogin.runescape.com/login.ws?username='.$username.'&password='.$password.'&dest=title.ws&mod=www&ssl=0'; #clear feed content var; $feedContent = ''; #initiate cURL function; $curl = curl_init(); #cURL options; curl_setopt($curl, CURLOPT_URL, $feedUrl); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 30 ); curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); #execute connection; $feedContent = curl_exec ($curl); #close connection; curl_close ($curl); if ($feedContent) { echo 'goodToGo'; } else { echo 'no good'; } ?> this works for me. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954319 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 Okay, it still doesnt work, I put fake information into the $username and $password it still says good to go. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954326 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 Bump. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954337 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 You have been blocked from logging in, because too many requests have been made from your IP in a short space of time. Please try again in a few minutes. they zapped me, so you're gonna have to test. forgot your scraping preg_match() function .. also overlooked something .. changed out: curl_setopt($curl, CURLOPT_POST, 1); and replaced with: curl_setopt($curl, CURLOPT_GET, 1); try this code: <?php #credentials; $username = 'codingforums'; $password = 'donotchange'; #full URL; $feedUrl = 'https://weblogin.runescape.com/login.ws?username='.$username.'&password='.$password.'&dest=title.ws&mod=www&ssl=0'; #clear feed content var; $feedContent = ''; #initiate cURL; $curl = curl_init(); #cURL options; curl_setopt($curl, CURLOPT_URL, $feedUrl); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 30 ); curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_GET, 1); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); #execute connection; $feedContent = curl_exec ($curl); #close connection; curl_close ($curl); if ($feedContent) { if (preg_match ("/Your login was successful. You will shortly be redirected to your destination./i", $feedContent)) { $valid = 'Valid'; } elseif (preg_match ("/Login Failed - Invalid Username or Password/i", $feedContent)) { $valid = 'Invalid'; } else { $valid = 'Cannot check! Too many invalid logins'; } echo $valid; } else { echo 'no connection'; } EDIT: no need to bump .. it's not like topic is on the fifth page or something. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954347 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 was able to stop their script and see that POST is used and not GET; here is working script: <?php #credentials; $username = 'codingforums'; $password = 'donotchange'; #full URL; $feedUrl = 'https://weblogin.runescape.com/login.ws'; #clear feed content var; $feedContent = ''; #initiate cURL instance; $curl = curl_init(); #cURL options; curl_setopt($curl, CURLOPT_URL, $feedUrl); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_TIMEOUT, 30 ); curl_setopt($curl, CURL_HTTP_VERSION_1_1, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, 'username='.$username.'&password='.$password.'&dest=title.ws&mod=www&ssl=0'); curl_setopt($curl, CURLOPT_ENCODING, "gzip, deflate"); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); #execute connection; $feedContent = curl_exec ($curl); #close connection; curl_close ($curl); if ($feedContent) { if (preg_match ("/Your login was successful. You will shortly be redirected to your destination./i", $feedContent)) { $valid = 'Valid'; } elseif (preg_match ("/Login Failed - Invalid Username or Password/i", $feedContent)) { $valid = 'Invalid'; } else { $valid = 'Cannot check! Too many invalid logins'; } echo $valid; } else { echo 'no connection'; } ?> Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954366 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 So it works for you? On my host it doesnt. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954380 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 ya, returns 'Valid'; Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954396 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 Whats a php code to test if curl is enabled? For me it wont work on my webhost. >.> Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954416 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 your script would break and you would receive a Fatal error if cURL was not installed on the server. you can create file, call it phpinfo.php, and place the following code in it: <?php phpinfo(); ?> save it, and upload it to your server. then, using your browser's 'Find' function, type in cURL support .. beside it you will see either enabled or disabled. delete phpinfo.php from server. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954424 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 Yep, I am able to find curl, and its enabled.... then why would it be saying its invalid... Maybe Im ipbanned? Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954429 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 It wont work... U got any hosting websites I can try it on? Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954439 Share on other sites More sharing options...
mrMarcus Posted November 9, 2009 Share Posted November 9, 2009 Yep, I am able to find curl, and its enabled.... then why would it be saying its invalid... Maybe Im ipbanned? try logging in on the site .. you'll see there if your ip is banned or not. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954446 Share on other sites More sharing options...
Russia Posted November 9, 2009 Author Share Posted November 9, 2009 It lets me login, now I tried it on a different server, it worked for like 10 minutes, now it no longer works. Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954456 Share on other sites More sharing options...
Russia Posted November 10, 2009 Author Share Posted November 10, 2009 I just figured out why! They added a captcha to the site, so when u login 3 times incorrectly, it makes u solve a captcha... Link to comment https://forums.phpfreaks.com/topic/180896-curl-or-script-not-working/#findComment-954464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.