playa Posted January 8, 2007 Share Posted January 8, 2007 I am trying to make a php script which automates a few things. I want it to automatically go to a site and login with two form inputs. How would I make it go to another site and do that? Sorry, I have looked for this for a really long time but I am not too sure about how to word it and I am kind of a noob. So, all help would be appreciated. :) Quote Link to comment Share on other sites More sharing options...
fert Posted January 8, 2007 Share Posted January 8, 2007 cURL and a cron will do what you want to do Quote Link to comment Share on other sites More sharing options...
Clarkey_Boy Posted January 8, 2007 Share Posted January 8, 2007 Is this not classed as scripting, which is not allowed on most sites (particularly online games)? Or are you talking about logging in to a site which you own?RC Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 9, 2007 Share Posted January 9, 2007 oh noes, he's gonna hax0r neopets. Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 lol @ hax0r neopetsi agree with the curl idea, but cron?! like a cron job run by a linux server?u may be able to do some javascript and do like document.myForm.element.value = "pass"; for the vars that type of thing and maybe document.myForm.submit; to submit.. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 9, 2007 Share Posted January 9, 2007 You KNOW you wanna hax0r Neopets. That's what all the cool kids use PHP for. That and changing their college GPA. Oh wait, that's just senators. You schedule the cron job to run the page which uses curl? I think that's what he meant by curl and cron. I don't know about curl so I have no idea if that makes sense. Yarr. Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 [quote author=jesirose link=topic=121574.msg500229#msg500229 date=1168305102]You KNOW you wanna hax0r Neopets. That's what all the cool kids use PHP for. That and changing their college GPA. Oh wait, that's just senators. You schedule the cron job to run the page which uses curl? I think that's what he meant by curl and cron. I don't know about curl so I have no idea if that makes sense. Yarr.[/quote]sure, it makes sense..cron job can run the php script with the curl command in it..although cron jobs only run once a week on most servers unless u own it.. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 9, 2007 Share Posted January 9, 2007 No, cron runs when you schedule it. Quote Link to comment Share on other sites More sharing options...
playa Posted January 9, 2007 Author Share Posted January 9, 2007 I tried searching cron jobs and curls but I didn't really understand what to do exactly. Is there any tutorials any of you know of?And no, this isn't for any online game, my dad has his some kind of business system and the person is coming to set it up. All the orders and information gets sent to a database file on a different server and I was wondering if there's a way that I can make it go on after every 12 hours, enter the username and password to enter the file, and save a seperate file with the same contents, and delete the main file so it keeps getting refreshed. All I needed to know right now is how to make a code in php so that it goes to the site, enters the username and password. The rest I can see later. I don't really need to do this myself, but I just want to know it for general knowledge. Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 [code]<?php $post_data = "username=username&password=password"; $url = "http://www.site.com/validationscript.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $result = curl_exec($ch);?>[/code]Try something like the above..but the thing with curl is, you need to know the exact fields that need to be passed and what script validates it.. With my site i tried that script, but since i didn't pass my ip, user agent, browser, among other things i have set up, plus encryption..it doesn't actually let me stay logged in...so modifying those post fields just like your get vars would look inside the address bar and get to work :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.