Is here any way to send information to two url with the same form using get of post method at one time?Please suggest me?

Member Avatar for diafol

get of post method at one time

Is that get or post?

Do you have control over either remote sites?

If not I suppose you could send GET to two iframes in the formhandler page - set the src values to the siteXurls and attach the querystring to each. It's not elegant and I haven't tried it but I assume it should work.

Else you could use cURL on POST data.

Here's a cURL example:

http://davidwalsh.name/execute-http-post-php-curl

However, he does use extract() on $_POST data - not something I'd recommend.

I've never tried it before, but can't this be done easily with JS? Use AJAX to submit the form once, then either use a callback function to submit again, or let the form continue processing and go to the action page?

EDIT:
To be fair though I suppose using PHP is better in case the user has JS disabled or is using a non-JS browser.

Member Avatar for diafol

If using ajax/js - you must use a cross-domain solution. I'm not sure that a vanilla jQuery ajax routine will work with remote sites.

True, though the OP didn't specify that he was interested in forwarding the data to remote sites. Not sure if "URL" refers to that, or if he just means two different pages/files.

commented: Yep - my mistake. Thanks for pointing it out. +14
Member Avatar for diafol

Yeah, fair comment EF, I just took it for granted for some reason that they were remote - and reading back there were no such statements. My bad.

All good, it was a good point that it wouldn't work for remote sites =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.