Log in

View Full Version : Posting to Curl with post params from server



benslayton
01-31-2010, 10:51 AM
Heres what I am trying to acomplish. I need to automate making databases from a php script. My host doesnt have an API for this and the control panel is proprietary to them.

Currently my script will post my username/pass over using cookies and display a secure page.

So now I need to post to a secure page inside the web manager.
Only problem is this...

The way the form process works normally is a 2 step process.

First form is database name info and then once you fill that out you get redirected to domain.com/AddDatabaseUser.do

This is the part i dont understand. If the form was a one step process I would understand. So my question.

How do I post first to domain.com/AddDatabase.do and then post to domain.com/AddDatabaseUser.do and keep the posted info from the web hosting server to stay posted to the 2nd form page "domain.com/AddDatabaseUser.do"?

Thanks,
Ben

benslayton
01-31-2010, 05:58 PM
I wonder if this is what I am looking for?

http://www.php.net/manual/en/function.curl-multi-init.php

djr33
01-31-2010, 10:17 PM
I don't know what the restrictions are on your host, but many/most don't allow this. Even if it does, there may be a limited number available. And it also makes keeping track of it difficult.
This is why all major php packages that use mysql don't do that: instead, they just add a prefix like package_ before all of the table names.
I'm not sure if this works for you, and it might end up making a huge database, but unless you are creating a server trying to give access to one database for each user, then the prefix method will probably be a lot easier for you.

As for executing a request without the browser going there, yes, curl will do that. It also would be hidden from the user so that would mean that you can do it somewhat securely: check the IP of the request, etc.

benslayton
01-31-2010, 10:20 PM
I just got it to work about 10 minutes ago. Had a buddy help me out with it.

I don't want a really small database nor do I want a huge database. I will probably end up prefixing 20 customers to one db.