View Full Version : Can I automattically login to a php site through JS?

03-16-2004, 10:49 PM
Can I login to a php site through JS for automatic upload, so I can create a control panel? and other stuff like that? please answer, thanks!

03-16-2004, 11:09 PM
Automatic upload? Control Panel? Huh?

Where are you planning on putting this "logging in" Javascript code?

You obviously cannot put it on the website you are wanting to login to...

Funny enough, I wanted to do this (well, the logging in part...) in Javascript not long ago, and found that it is not possible. I created a page with frames, had my Javascript in one frame, and the website in the other.

You cannot use Javascript from one frame on another (I was hoping to use DOM, etc..) unless both pages share the same domain. This is a security thing to prevent people like use from doing this.

Well, I didn't give up on it, and I switched to using another method called cURL, and used PHP to assist me in writing a script to go about this.

cURL is basically a command-line web-browser (at least that's the way I think of it..). Using PHP, you can either call cURL off the command line, or import some cURL libraries into your PHP and write a script that way.

There are lots of examples online as to how to do this. Snoopy is another module, like cURL that will allow to do similar things. Uploading files are also possible (as is anything to do with POST, and much more).

But to simply answer your question, NO, Javascript cannot be used to login to a website. You'd have to use something like cURL or Snoopy.

If anyone on this forum knows differently, please let us know -- I'm still very curious!

Hope that helps,

03-17-2004, 09:29 PM
if loggin in is no, I guess I could use frames, but I still would like to use JS to upload, and I will program the js, my upload site is programmed in js, so would it work?

03-17-2004, 10:08 PM
I don't understand what you're talking about.

While you're clearing up your previous post, why don't you also clearly explain what it is you're trying to do. In other words, why do you think you need to automatically login to some site and upload something?

If you give us some background, we may be able to help you better, even if it means coming up with a different/better solution.


03-17-2004, 11:13 PM
I mean that could program JS into my site and program it to upload files onto the site, almost copying the same thing the server does to upload but put it on my site. but it won't be copying....

I hope that is more clear.