Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Curl or script not working.
Old 11-09-2009, 04:06 PM Curl or script not working.
Super Talker

Posts: 115
Name: Not Telling
Trades: 0
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 *******)

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 Code:
<?php
$username 
"username";
$password "password";

   
$ch curl_init();
   
curl_setopt($chCURLOPT_URL"https://weblogin.runescape.com/login.ws"); 
   
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
   
curl_setopt($chCURLOPT_RETURNTRANSFER1);
   
curl_setopt($chCURLOPT_SSL_VERIFYPEER0);
   
curl_setopt($chCURLOPT_POST1);
   
curl_setopt($chCURLOPT_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?
__________________
MY MSN:
Please login or register to view this content. Registration is FREE

PHP, HTML, and CSS Coding, Logo and Web Design - Professionally done.
PM me anytime for HTML, PHP or web design help. I will be glad to help you out.
sith717 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-09-2009, 05:49 PM Re: Curl or script not working.
lizciz's Avatar
Webmaster Talker

Posts: 744
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Are you certain that the string
PHP Code:
"Your login was successful. You will shortly be redirected to your destination." 
is correct? Should there i.e. be a dot atthe end, since there aren't one in

PHP Code:
"Login Failed - Invalid Username or Password" 
To be sure, can't you just search for the strings "success" and "failed"?
__________________
34343639363436653237373432303635373837303635363337 34323037343638363137343263323036343639363432303739 366637353366
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 11-09-2009, 07:22 PM Re: Curl or script not working.
Super Talker

Posts: 115
Name: Not Telling
Trades: 0
Okay I changed it around.

Here is the updated:

PHP Code:
<?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($curlCURLOPT_URL$feedUrl);
curl_setopt($curlCURLOPT_FOLLOWLOCATION1);
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
curl_setopt($curlCURLOPT_HEADER0);
curl_setopt($curlCURLOPT_TIMEOUT30 );
curl_setopt($curlCURL_HTTP_VERSION_1_1true);
curl_setopt($curlCURLOPT_SSL_VERIFYPEER0);
curl_setopt($curlCURLOPT_POST1);
curl_setopt($curlCURLOPT_POSTFIELDS'username='.$username.'&password='.$password.'&dest=title.ws&mod=www&ssl=0');
curl_setopt($curlCURLOPT_ENCODING"gzip, deflate");
curl_setopt($curlCURLOPT_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'; }
?>
My friends tried it on there server, all say it worked, when I try it on mine, it wont work... By the way curl is installed AND enabled.
__________________
MY MSN:
Please login or register to view this content. Registration is FREE

PHP, HTML, and CSS Coding, Logo and Web Design - Professionally done.
PM me anytime for HTML, PHP or web design help. I will be glad to help you out.
sith717 is offline
Reply With Quote
View Public Profile
 
Old 11-10-2009, 05:29 AM Re: Curl or script not working.
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
print $feedContent and look with your eyes what does it look like
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to Curl or script not working.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.46427 seconds with 12 queries