php - Submit external form without leaving the page/site -


i looked through site answers this, nothing's spot on need (this close, except doesn't submit form: prevent form redirect or refresh on submit?).

i'm trying incorporate mailing list sign-up (code borrowed sign-up page hosted on reverbnation) website.

the form submits properly, signee redirected hideously rendered page on reverbnation's site. cannot modify script , don't think there's api can use keep things tidy.

is there way can submit form in background, without user being redirected?

here's example in php tunneling post.

//set post variables $url = 'http://domain.com/url-to-post-to'; $fields = array(             // add fields want pass through             // remove stripslashes if get_magic_quotes_gpc() returns 0.             'last_name'=>urlencode(stripslashes($_post['last_name'])),             'first_name'=>urlencode(stripslashes($_post['first_name'])),             'email'=>urlencode(stripslashes($_post['email']))         );  //url-ify data post foreach($fields $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&');  //open connection $ch = curl_init();  //set url, number of post vars, post data curl_setopt($ch,curlopt_url,$url); curl_setopt($ch,curlopt_post,count($fields));  // returns response string instead of printing curl_setopt($handle, curlopt_returntransfer, 1); curl_setopt($ch,curlopt_postfields,$fields_string);  //execute post $result = curl_exec($ch);  //close connection curl_close($ch);  echo $result; 

Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -