私は、私たちを訪問して私たちのウェブサイトに登録するユーザーが、ある機会を見ることができるようにセカンダリWebサイトにアカウントを持っている登録システムを作ろうとしています。PHP(POST)を使用してcURLを使用した完全なフォーム
だからここには行く:The website were I want to POST the Form and Register
私のコードを、これまで
<?php
// set post fields
$post = [
// this i don't master fell free to approach the subject for future reffrance
'authenticity_token'=>'vhmPffEAIiIbjo36K8CI77+YDQfMPBWEG8ymplsGJ0w=',
'user[email]'=>'[email protected]',
'user[first_name]'=>'test',
'user[last_name]'=>'test',
'user[password]'=>'12345678',//smart password (had to be 8char long)
'user[country]'=>'Country(placeholder)',
'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
curl_close($ch);
// do anything you want with your response
var_dump($response);
?>
ストーリー:
私は、ドメインAの上と同じで、フォームに記入することができるようにしたいユーザーとしてCURL、あるいはJSとAJAXを使ってドメインBにアカウントを持っています。
これを達成するための解決策がある場合は、私に教えてください:)あなたはウェブサイトでも見ていることができます。
ありがとうございました!
後期編集
I`veはPOSTMANにこれを作りました。だから私はその情報を投稿するためにできるはずだと思う。あなたは他の提案がある場合。
この場合、サーバはエラーとして成功として500と200を返します(セキュリティ)最終的な作業コードで
<?php
// set post fields
$post = [
// this i don`t master fell free to approach the subject for future reffrance
'authenticity_token'=>'NKWAg8mGA9gUueBaJ5Og+oEOC5O2rZarZzMK+GnjuCA=',
'user[email]'=>'',
'user[first_name]'=>'',
'user[last_name]'=>'',
'user[password]'=>'',//smart password (had to be 8char long)
'user[country]'=>'',
'user[mc]'=>'', //id of the country
'user[lc_input]'=>'', //id of the dropdown
'user[lc]'=>'',//id of the dropdown
'commit'=>'REGISTER',//value of submit
];
$ch = curl_init('https://auth.aiesec.org/users/');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
// execute!
$response = curl_exec($ch);
// close the connection, release resources used
curl_close($ch);
// do anything you want with your response
var_dump($response);
?>
実際の質問は何ですか? – Ikari
ユーザーが私の – Daniel