Jump to content

PHP = Making PHP Script Program


playa

Recommended Posts

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. :)
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[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..
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

[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 :)
Link to comment
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.