Page 1 of 1
How do I do this? Is it a web service?
Posted: Wed Dec 10, 2003 9:43 am
by Klaws_wolverine
Hi all,
I have an online form, this form must be sent to another server that will parse it. If that server is down, all form data should be queued, also this way data will only be sent from our site's IP address, to prevent DDos attacks.
Anyhow, how do I do this queuing thing? Should I create a SOAP envelope, is a web service needed?
I would apreciate any help anyone can provide.
Thanks
Posted: Wed Dec 10, 2003 9:57 am
by malcolmboston
not sure if queueing is possible
unless you do somethng to the effect
if
//connection possible
send
else
//connection not possible
store in MySQL
try googling i have no idea, btw there are several software that can do this
http://www.hotscripts.com/PHP/Scripts_a ... more4.html
not a mailing list
Posted: Wed Dec 10, 2003 10:45 am
by Klaws_wolverine
Hi,
Actually I cannot use those scripts at the link, because it's form data that will be sent, not an smtp email.
I need to know how to do this with a web service, and from what i've heard, it will be queued and web services takes care of that for you.
Thanks
Re: not a mailing list
Posted: Wed Dec 10, 2003 1:56 pm
by Weirdan
Klaws_wolverine wrote:
I need to know how to do this with a web service, and from what i've heard, it will be queued and web services takes care of that for you.
If you decide to implement queue by yourself, I'd suggest the following `hand-made` design:
1. script, say accept.php, accepts the data from the customer and place it into queue (mysql db or file or something).
2. another script, either the standalone daemon or cron job retrieves the data from queue and posts it to remote processing server (You can do it using [php_man]curl[/php_man] extension).
Yes, that's it
Posted: Wed Dec 10, 2003 3:06 pm
by Klaws_wolverine
Hi Weirdan,
While it is in the queue line, does it have to go into mysql or in a file, can't it be in-memory?
Regarding your accept.php and ur curl function, would you be so kind as to provide some snippets of code? And I don't know curl at all, what's the learning curve?
I would apreciate any help anyone can give me. I was initially think of doing this with NuSOAP.
Thanks
Re: Yes, that's it
Posted: Wed Dec 10, 2003 3:25 pm
by Weirdan
Klaws_wolverine wrote:While it is in the queue line, does it have to go into mysql or in a file, can't it be in-memory?
It can't, I guess. What if the server which hosts accept.php is crashed before it has submitted the data to processing server?
Klaws_wolverine wrote:
Regarding your accept.php and ur curl function, would you be so kind as to provide some snippets of code? And I don't know curl at all, what's the learning curve?
Curl: first, read the manual, this extension has pretty straightforward syntax. It's as simple as
Code: Select all
$ch=curl_init("http://remote.server.com/remote/page.php");
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POST,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,array("first_field"=>"something","second_one"=>"something_else"));
$result=curl_exec($ch);
// now $result variable holds the remote server response
accept.php:
Simple form processing page which stores the data into db.
Writing a daemon can be a bit tricky, I'd suggest not to go this way if you haven't ever wrote one

. Use cron instead. Here is a
tutorial.