Daniel Daniel - 5 months ago 20
Ajax Question

Complete form with cURL using PHP (POST)

I'm trying to make a registration system where users that visit us and register to our website will have an account on a secondary website in order for them to be able to see some opportunities.

So here it goes: The website were I want to POST the Form and Register

My code so far

// set post fields
$post = [
// this i don't master fell free to approach the subject for future reffrance
'user[password]'=>'12345678',//smart password (had to be 8char long)
'user[mc]'=>'1560', //id of the country
'user[lc_input]'=>'1475', //id of the dropdown
'user[lc]'=>'1475',//id of the dropdown
'commit'=>'REGISTER',//value of submit


$ch = curl_init('https://auth.aiesec.org/users/sign_in');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

// execute!
$response = curl_exec($ch);

// close the connection, release resources used

// do anything you want with your response


As a user I want to be able to complete a form on domain A and at the same time have an account on domain B using CURL or even JS and AJAX.

If you have any solution to achieve this please let me know :) You can also have a look on the website.

Thank you!

Late edit

Postman POST account

I`ve made this in POSTMAN. So I think I should be able to make the for post that information. If you have other suggestions.

In this case server returns 500 as success and 200 as error (security)


You are connection via https. So you should add these lines:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

I tested your code and the website responded "Wrong username / password". That means curl is connecting correctly.