Page 1 of 1

Need a pointer towards instruction

Posted: Mon Sep 18, 2006 9:20 pm
by train
Hi,

I am a big dummy.

I was using a form that a previous developer made for my company. I was going to adopt it and put it on our public website. It updates a machine on our network with a private IP. The form is PHP and our web server is IIS, ASP. The form talks to a machine that is really useless now, save this form.

Of course, from my desk, this form works great. My machine knows the aliases of the other computers on the network. We have no more public IP addresses.

It does work from my desk.

But not from home.

So I installed PHP on our web server thinking that if I could at least bring the form up and begin a PHP dialog from outside our network, PHP would be able to talk to our private server with the MySQL database, and it would work.

Well, it doesnt. I dont exactly know why... but it gives me a 404.

I think it has something to do with the fact that my computer at home is trying to resolve private.company.com and cannot? It shouldnt - I dont think - have to. I would think all that logic would be handled on the network and not even be visible to my machine... but Im wrong. I know.

So I am going to install MySQL on our web server alongside MSSQL. At least I can get it working this way.

I need to just code a form to use for this client intake procedure, with required fields. I cant use the existing one. It is way overkill, and calls functions that have no place in what I am doing.

Can anyone point me towards a tutorial or example that will show me how to do required fields and simple stuff like that? Please dont groan. I have looked. I have read a million simple form tutorials, but they always confuse me (most are spread over 10000 pages of adsense) and the require field validation isnt something I can pin down. I have yet to see a comprehensive, lucid, explanation.

I would appreciate a pointer toward something good.

And I am very sorry to have such a stupid question. I have been battling with this for too long.

Thank you.

Posted: Mon Sep 18, 2006 10:45 pm
by feyd
If the form submits to that internal machine, then you will not be able to interact with it. The form must submit the information to your webserver which can then pass on that request to the internal machine.

Thanks... so then can I...

Posted: Tue Sep 19, 2006 6:39 am
by train
Thank you, Sir, for your response.

Maybe someone will indulge me here:

It makes sense, then, as a temporary solution, for me to submit to my web sever and then have my web server submit to the private box.

If I have this form submit to some file on the web server, the $_POST variables are there on the web server. Can I do something tricky to take these $_POST variables and repost them to the private box?

So, $_POST variables would get posted, again.

This is a temporary solution.

There wont be any buttons getting pushed to initiate the post. Need help on that, too.

Sorry... truly I am.

Posted: Tue Sep 19, 2006 8:09 am
by feyd
cURL or some other related library may be of interest.

Posted: Tue Sep 19, 2006 8:53 am
by train
feyd wrote:cURL or some other related library may be of interest.
Okay, this is more difficult than I hoped.

I thought maybe I could do an include, or just resubmit everything...

Posted: Tue Sep 19, 2006 9:22 pm
by train
train wrote:
feyd wrote:cURL or some other related library may be of interest.
Okay, this is more difficult than I hoped.

I thought maybe I could do an include, or just resubmit everything...
Okay, I did it.

And this is my code:

Code: Select all

$ch = curl_init("http://oldserver.mycompany.com/somepage.php");
curl_setopt($ch, CURLOPT_POST); //use the POST method
curl_setopt($ch, CURLOPT_POSTFIELDS, $_POST); //take the $_POST array
and use those as the POST parameters for the curl request
curl_exec($ch); //execute the request
Do both servers need to have curl enabled?

I get this error:

Code: Select all

on registration.php \\the form that registers client
PHP Warning: Cannot open 'C:\\Program Files\PHP\extras' for reading in Unknown on line 0
on forms/middle.php \\middle.php is the file that has the curl in it

Warning: Wrong parameter count for curl_setopt() in D:\ULEM WebSite\forms\middle.php on line 5
Message was not sent \\I think I have the right number of parameters...

Please tell the Administrator: Mailer Error: Could not instantiate mail function.PHP Warning: Cannot open 'C:\\Program Files\PHP\extras' for reading in Unknown on line 0 \\not sure why mail is being called... it doesnt mail a thing...
Thank you very much for your time.

Posted: Tue Sep 19, 2006 10:16 pm
by feyd
CURLOPT_POSTFIELDS expects a string, not an array.