views:

68

answers:

2

Hi there

I have a problem where the server I'm using is not configured to allow PHP or CGI and I need to send a mail using variables received from a form on this server to the owner, like a general enquiry/feedback form.

Does anyone know how I can call a simple PHP file on another domain configured to use PHP and then execute the mail() function on that server with variables passed to it from my non-PHP/CGI server?

How do I enable cross-domain AJAX calls without the originating server having PHP/CGI enabled?

Any feedback/advice would be greatly appreciated.

+2  A: 

It's probably somehow doable using JSONP, but you don't need Javascript for this. The much easier solution would be to place the sending PHP script on the remote server, e.g.

 www.serverwithphp.com/send.php

and then to point the feedback form directly to that script:

 <form action="http://www.serverwithphp.com/send.php" ....>

and have send.php do a header redirect back to the original site after sending:

 header("Location: http://www.serverwithoutphp.com/thanks.htm");
 die();
Pekka
Thanks, I never thought of it that way. I'll try it first thing tomorrow morning.
Anriëtte Combrink
Thank you, this works like a charm. :D
Anriëtte Combrink
A: 

On applications supporting it, you can do it with JSONP

Vinko Vrsalovic