View Full Version : Programming Help

Mar 13th, 2013, 01:39 AM
Hi I am new to programming and looking for some help. I want to create a program to automatically choose a size and add a pair of shoes to the cart on nike.com. I am willing to do it myself; I just need to know if I would use Java or what type of program I need to learn how to learn.

Old Pedant
Mar 13th, 2013, 02:06 AM
First of all, if you want to use Java, you are in the wrong forum. This is the JavaSCRIPT forum. About the only thing Java and JavaScript have in common are the first 4 letters of their names.

Assuming you meant JavaScript:

You probably can't do it.

You can't use JavaScript from your own pages/site to affect *ANYTHING* on some other site.

What you *MIGHT* be able to do is to clone the <form> on the Nike site to your own site, making sure that the action= of the <form> still points to the Nike site. Then you could use your own JS code on your own site to fill in the <form> and submit it to the Nike site. More than likely, that won't work. And that's because, of course, to Nike you look like somebody trying to hack their site and submit bogus orders. So, like most modern sites, they will have all sorts of code in place to detect attempts to do this very thing. Just for example, and the most obvious thing to check and the easiest for even a beginner in server-side programming to implement: Whan any <form> is submitted (or any page is linked to another, for that matter), the receiving site can check something called the HTTP_REFERER, which tells it what site *AND PAGE* the <form> or other link came from. And if the REFERER is not what the site is expecting, it rejects the attempt.

Now, HTTP_REFERER isn't too terribly hard to spoof. Though you won't do it with just JavaScript code. You would need some server-side knowledge to do that, albeit not too much. But that's just the very first line of defense that a *GOOD* eCommerce site will erect against people like you who want to hack them.

SO... If you are truly a newbie, I'd say you are very very unlikely to succeed at this. And if you aren't a newbie, your changes of success are still pretty darned small.