我正在创建从提交到 aweber 的应用程序,但我还需要输入字段存储在数据库中

i am creating application where submitting from to aweber but i also need input fields to store on db

<form method="post" class="af-form-wrapper" action="http://www.aweber.com/scripts/addlead.pl">

我正在创建一个从 aweber 提交的应用程序,但我还需要输入字段以存储在数据库中。但是我还需要输入来在我这边存储 inv 数据库,因为我们不能有两个动作,所以我怎样才能将它们放入 PHP。

您可以使用 javascript 或 jquery

单击提交按钮后,您可以将表单数据发送到 url,也可以 post 将该数据发送到控制器,然后将其插入数据库。

<form id='myform' method='post'>
<input />
<input />
<button id='submit'></button>
</form> 
$('#submit').on('click', function(){
  $.ajax({
      'dataType': 'json',
      'type': 'POST',
      'data': $('#myform').serialize(),
      'url': 'http://www.aweber.com/scripts/addlead.pl',
       success: function (data) {
         //what ever you want to do with the return data
       }
   })
  $.ajax({
      'dataType': 'json',
      'type': 'POST',
      'data': $('#myform').serialize(),
      'url': 'your code igniter controller url',
       success: function (data) {
         //what ever you want to do with the return data
       }
   })
})

我们可以在 CURL 的帮助下做到这一点

    public function signup()
{
    $fields_string='';
    $ch = curl_init('http://www.aweber.com/scripts/addlead.pl');
    $fields = array(
        'name' => $this->input->post('name'),
        'email' => $this->input->post('email'),
        'meta_web_form_id' => '1122',
        'meta_split_id' => '',
        'listname' => 'abc',
        'meta_redirect_onlist' => '',
        'meta_adtracking' => 'My_Web_Form',
        'meta_message' => '1',
        'meta_required' => 'name,email',
        'meta_forward_vars' => '0',
    );
    foreach($fields as $key=>$value)
    {
        $fields_string .= $key.'='.$value.'&';
    }
    rtrim($fields_string,'&');
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0');
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch,CURLOPT_POST,count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $returned = curl_exec($ch);
    $this->register_user($fields);
}

$this->register_user($fields); // 当我们将名称和电子邮件传递给该函数时,此函数会将值存储在我的数据库中