Click to See Complete Forum and Search --> : Neopets Robot


chesemonkyloma
01-20-2007, 03:30 PM
I would like to know how to create a bot that would access my Neopets bank page and collect the interest automatically everyday. This is more of a proof-of concept to me than an actual purpose but I think it would be pretty cool. I know I would have to make a cronjob that would do it everyday. I'm not sure about how I would actually send the post requests needed to login and to access the bank. Does anyone have any ideas?

Kyleva2204
01-20-2007, 05:38 PM
wouldn't it just be easier to grab the information everytime the page is loaded using CURL or something? I think its like file_get_contents().. and then use some preg_match's to get the content you need..

function.file-get-contents.php (http://us3.php.net/manual/en/function.file-get-contents.php)

function.preg-match-all.php (http://us3.php.net/manual/en/function.preg-match-all.php)

read the docs :)

chesemonkyloma
01-20-2007, 06:45 PM
No, it's not that I'm looking at the page, I know how to use file_get_contents easily. The interest is not given automatically, you have to click a button to collect it. This requires a POST request because it uses a form. The bot actually has to send information to the server, it's not just a matter of getting the page.

Kyleva2204
01-20-2007, 07:00 PM
i know this is possible.. but I'm no good at sending POST information over a server.. sorry.

chesemonkyloma
01-20-2007, 07:04 PM
me neither lol... im glad i could clarify what i was asking for though

bathurst_guy
01-20-2007, 07:12 PM
You cannot send POST requests from one server to another.

chesemonkyloma
01-20-2007, 07:28 PM
how do people make bots that sign up for things which require people to use CAPTCHA? doesn't that require post?

bathurst_guy
01-20-2007, 07:54 PM
You going to need something a little stronger than PHP then, some real hard coding.

NightShift58
01-20-2007, 11:55 PM
You cannot send POST requests from one server to another.You can with cURL...

See: http://us2.php.net/manual/en/ref.curl.php

bathurst_guy
01-21-2007, 12:14 AM
Do you have an example we could see?

NightShift58
01-21-2007, 12:18 AM
Let me make one.... 2 mins?

NightShift58
01-21-2007, 12:35 AM
We have three scripts.
1. bathurst_guy1.php: This does the actual post
2. bathurst_guy2.php: This is the form we bypass
3. bathurst_guy3.php: This is the action in the form

Example: http://www.nightshift58.com/webdev/test_bathurst_guy/bathurst_guy1.php

bathurst_guy1.php:<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.nightshift58.com/webdev/test_bathurst_guy/bathurst_guy3.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,"fname=night&lname=shift&year=58");
curl_exec ($ch);
curl_close ($ch);
?>bathurst_guy2.php:<form method='post' action='bathurst_guy3.php'>
L.Name: <input type='text' name='fname'><br>
F.Name: <input type='text' name='lname'><br>
Year: <input type='text' name='year'><br>
<input type='submit' value='submit'><br>
</form>bathurst_guy3.php:<?php
print "FNAME = " . $_POST['fname'] . "<br>";
print "LNAME = " . $_POST['lname'] . "<br>";
print "YEAR = " . $_POST['year'] . "<br>";
print "<br>";
print "All together: " . $_POST['fname'] . $_POST['lname'] . $_POST['year'] . "<br>";
?>

bathurst_guy
01-21-2007, 02:22 AM
Cool thanks.

NightShift58
01-21-2007, 01:15 PM
Cool, yes, but one also has to protect against this possibility.

This is the kind of stuff that spammers use to post spam mails through form mails but that's probably been covered in a number of other threads.

chesemonkyloma
02-19-2007, 03:46 PM
THANK YOU! I'm sorry I haven't been keeping up to date with this topic I created, but this is completely perfect! Thank you NightShift58!!

chesemonkyloma
02-19-2007, 03:50 PM
What happens if there are cookies involved for logging in?