PHP Curl (no redirection) - Form Submitting - Can not indentify the request and return two variables back -


I'm trying for a few days, but what I really need is, I can read so many posts on the internet I used to do many experiments but still can not get my result.

What do I need:

I have server1 and server I need to fill server 1 form from server 2 and submit it to the user without redirecting to server 1 , And after submitting the form I need PHP to be executed from server 1 and sending the form as a result will be sent back to server2.

Perhaps more clear with the code below:

By the way, the form is in ajax.

Server 2:

$ url_base

  = 'the_path_of_the_ url_of_the_form_frontend_file_server_1.php'; $ Url_param = 'name =' $ _USER ['name'] '& Amp; Email = '$ _USER [' email ']' & amp; Phone = '$ _USER [' phone ']' & Amp; Country = '$ _USER [' country ']. '& Amp; Password = '$ _USER [' password ']' & Amp; Verify_code = '' - '' & Amp; Group = '1' & Amp; Lever = '100' & Amp; Deposit = '10000' & Amp; State = '' - '' & Amp; Zipcode = '' - '' and city = '' - '& amp; Phone_password = '' - '' & Amp; Send_report = '' - '' & Amp; Register_demo = 'yes_register'; $ Ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, $ url_base); Curl_setopt ($ CH, CURLOPT_FOLLOWLOCATION, 0); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); Curl_setopt ($ ch, CURLOPT_TIMEOUT, 30); Curl_setopt ($ CH, CURLOPT_POST, 1); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, $ url_param); Curl_setopt ($ ch, CURLOPT_HTTPHEADER, array ('content-type: application / jason', 'content-length:'. Strlen ($ url_param)); $ Result = curl_xac ($ CH); Curl_close ($ ch);   

My code is sending data from Server 2 to Server 1 and completing the form and displaying HTML as a $ result, but I After this, the requirement is to be stored in server1 from Form Server 2, I need that the form PHP of the form will be executed from server 1 and the result of the form will be sent back, after the form submission, Login and password will be user Email, login and password form is created after the submission of the form.

I am sending an additional parameter to this one & amp; Register_demo = 'yes_register'; When Form 1 is completed by server, 2 files in my form is a file for front-end and the second one for back-end because I use AJX.

If I am not mistaken, then after fixing on Form2 server 1 on the server, I get cured, but it seems that PHP is not executed on server 1 that I login and I can get back the password. And I try to get this parameter '& amp; Register_demo = 'yes_register'; Not doing anything like this, it appears that the form is only present and not going to the back-end file.

Please be very appreciative for any help, this situation is going crazy to me. > I came out of this solution because the form can only be deposited with one IP, and for this reason I have the same form on the other server, I need to submit form 2 to server in some way Have and login to the server and get the password 2 to display it to the user.

Thank you in advance.

I will describe the solution given below, and if someone needs help, then I will solve it I can help

Solution:

Using AJAX due to my form, I was sending the curl to the server to complete the form on server1 and to be executed on the PHP server Get the results after 1. My AJAX was not executed due to AJAX.

That's why I created an API that Server 2 will consume it, I have implemented a form and all the PHP in a separate file that I need to execute (plane PHP). After that I was sending the colon to the API I did and executing PHP and returning the desired results.

If someone needs more help in this matter, please contact me and I can help, or I can insert a code sample based on your request.

Thanks guys for the right signal.

Comments

Popular posts from this blog

php - how to change mysql_result($res, 0, "url"); to mysqli -

c# - Textbox not clickable but editable -

Matlab transpose a table vector -