Jump to content

Recommended Posts

hi,

 

I'm new in the world of PHP

so my question:

is it possible to code a bot with PHP for a browsergame which can:

- check if logged in else login into the game

- search on a map for targets or get them from a file

- attack this targets with an amount of troops

- logout

 

this php script should be run with a cronjob

 

any idea how to code that?

if need more informations just ask

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/
Share on other sites

Don't think your thinking of this exactly right.

 

First, are you running this from your computer or a webserver? Because it shouldn't like you could run it on a windows PC and either use task scheduler or just a while(true) { sleep($x) } loop.

 

Second, your going to open a new session with your PHP script -- you won't check to see if your logged in, you'll just log in.

 

Essentially what you are doing is just automating the same get / post requests a browser would send. How complex that is depends on the game -- for example, are the units and terrain one image, or is the background an image and the units overlayed on top? Makes a big difference -- the first way you have to figure out pixel colors, the second you have to parse though some source.

 

Regardless of the game, I'd consider this ambitious.

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369502
Share on other sites

but asking others to help you cheat a game and run a bot that's GUARANTEED against their ToS isn't always going to get amazing reception.

no,

because this server is on my root ;)

 

Don't think your thinking of this exactly right.

 

First, are you running this from your computer or a webserver? Because it shouldn't like you could run it on a windows PC and either use task scheduler or just a while(true) { sleep($x) } loop.

webserver

 

Second, your going to open a new session with your PHP script -- you won't check to see if your logged in, you'll just log in.

 

Essentially what you are doing is just automating the same get / post requests a browser would send. How complex that is depends on the game -- for example, are the units and terrain one image, or is the background an image and the units overlayed on top? Makes a big difference -- the first way you have to figure out pixel colors, the second you have to parse though some source.

 

Regardless of the game, I'd consider this ambitious.

 

how do I see the post requests?

There are some buttons which are no links but they send smth. like submit

:shrug:

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369564
Share on other sites

If this is a Flash game, I don't think it's doable with PHP. You would most likely have to manipulate the client for that, which PHP can't do.

 

There are a number of ways to inspect POST data. I like the TamperData addon for Firefox, but you can use a number of other tools like Firebug or Live HTTP Headers (both are addons for Firefox).

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369627
Share on other sites

So you have an open-source game on YOUR webserver. Where you have access to THE DATABASE. You want to create a bot that does some stuff so that you can gain... resources?!

 

Run this in phpmyadmin:

UPDATE players SET gold = gold + 99999999, iron = iron + 99999999, .. WHERE id = your-id

 

Refresh the page (or logout/login) and voila 99M gold, iron, ..

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369662
Share on other sites

So you have an open-source game on YOUR webserver. Where you have access to THE DATABASE. You want to create a bot that does some stuff so that you can gain... resources?!

 

Run this in phpmyadmin:

UPDATE players SET gold = gold + 99999999, iron = iron + 99999999, .. WHERE id = your-id

 

Refresh the page (or logout/login) and voila 99M gold, iron, ..

 

I am Mahn for president, and I approve this message!

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369683
Share on other sites

So you have an open-source game on YOUR webserver. Where you have access to THE DATABASE. You want to create a bot that does some stuff so that you can gain... resources?!

 

Run this in phpmyadmin:

UPDATE players SET gold = gold + 99999999, iron = iron + 99999999, .. WHERE id = your-id

 

Refresh the page (or logout/login) and voila 99M gold, iron, ..

 

that WOULD work but I want a bot and not giving players resources

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369762
Share on other sites

So you have an open-source game on YOUR webserver. Where you have access to THE DATABASE. You want to create a bot that does some stuff so that you can gain... resources?!

 

Run this in phpmyadmin:

UPDATE players SET gold = gold + 99999999, iron = iron + 99999999, .. WHERE id = your-id

 

Refresh the page (or logout/login) and voila 99M gold, iron, ..

 

that WOULD work but I want a bot and not giving players resources

 

Sorry if this sounds a bit rude, but you need to think a little, maybe outside the box.

They just told you how to fix this problem.

 

Why do you want to make a bot?

 

If you got full access to the server, then you could set a cron job (just like you said) to do what you said you want. Just write it to do what you want with full access to the server, and run it on the server side, because that's what PHP is for. This is just what they told you to do. If you want users to be able to use it too, then you may just let them access the same service.

 

If what you on the other hand want to is to create a bot that can be used on another site that runs the same open-source game, then that's a totally different matter. All you probably would need is cURL and PCRE functions, or maybe if you want use the DOMDocument class. To see the post/get/header data sent, use Live HTTP headers add-on for firefox, then you can mimic it with cURL. This will help you with what you request.

 

 

I could probably write one in like 15 minutes if you just tell me the game, as I requested earlier. >_>

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369770
Share on other sites

Get the Firebug extension if you don't already have it - it can be a huge help in reverse-engineering certain things. It has a feature called "Inspect Element" that you can use on images and buttons to try to get the javascript they call.

 

And yeah, I can see how a bot that mimics a player could be needed. People want to be attacked by a player with an army and different units -- not the same as just changing the amount of shit they have with no reason why.

Link to comment
https://forums.phpfreaks.com/topic/267089-bot-with-php/#findComment-1369774
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.