0

Infusionsoft API と XMLRPC を介して Web サイトから電子メールを送信するコードを開発しています。

ここに私のコード:

$email = $user_rec['email'];
    $contactID=$user_rec['client_infusionid'];      
    echo $contactID;

    $Subject = 'Your reset password request at GIC Deal Finders';

    $From = $this->GetFromAddress();

    $link = 'http://dashboard.gicdealfinders.info/resetpwd.php?email='.
            urlencode($email).'&code='.
            urlencode($this->GetResetPasswordCode($email));

    $htmlBody ='Hello '.$user_rec["name"].'<br/><br/>'.
    'There was a request to reset your password at GIC Deal Finders<br/>'.
    'Please click the link below to complete the request: <br/><a href="'.$link.'">'.$link.'</a><br/><br/>'.
     '<br/>'.
    'Regards,<br/>'.
    'Toyin Dawodu, MBA<br/>'.
    'Founder and Chief Relationship Officer';

    $clients = new xmlrpc_client("https://ze214.infusionsoft.com/api/xmlrpc");
    $clients->return_type = "phpvals";
    $clients->setSSLVerifyPeer(FALSE);
    ###Build a Key-Value Array to store a contact###
    $emailI = array(
    'contactList' => $contactID,
    'fromAddress' => $From,
    'toAddress' => $email,
    'ccAddresses' => 'admin@gicdealfinders.info',
    'bccAddresses' =>'abhilashrajr.s@gmail.com',
    'contentType' => 'HTML',
    'subject' => $Subject,
    'htmlBody' => $htmlBody,
    'textBody' => 'test');
    //$check=$myApp->sendEmail($clist,"Test@test.com","~Contact.Email~", "","","Text","Test Subject","","This is the body");

    ###Set up the call###
        $calls = new xmlrpcmsg("APIEmailService.sendEmail", array(
        php_xmlrpc_encode($this->infusion_api),         #The encrypted API key
        php_xmlrpc_encode($emailI)      #The contact array

        ));

        ###Send the call###
        $results = $clients->send($calls);
        //$conID = $results->value();
        /*###Check the returned value to see if it was successful and set it to a variable/display the results###*/
        if(!$results->faultCode()) {
            return true;
            } else {
                print $results->faultCode() . "<BR>";
                print $results->faultString() . "<BR>";
            return false;
            }

キャプチャされたエラーは次を示します。

-1
No method matching arguments: java.lang.String, java.util.HashMap

誰かが私のコードをチェックして、それを修正する方法を教えてもらえますか?

4

1 に答える 1

0

返されたエラーが示すように、間違ったパラメーターが Infusionsoft API に送信されます。

受け入れ可能なパラメーターのリストは、Infusionsoft API ドキュメントに記載されています。

まず、API キーを$emailI配列の最初の値として追加する必要があります。

また、Infusionsoft API は、2 番目のパラメーターが連絡先 ID のリストであることを想定しています。つまり、2 番目のパラメーター$contactIDは、php 側から配列として送信する必要があります。

次のコードは、修正を示しています。

$emailI = array(
    'yourApiKey',
    array($contactID),
    $From,
    $email,
    'admin@gicdealfinders.info',
    'abhilashrajr.s@gmail.com',
    'HTML',
    $Subject,
    $htmlBody,
    'test'
);
$calls = new xmlrpcmsg(
    "APIEmailService.sendEmail",
     array_map('php_xmlrpc_encode', $emailI)
);

また、コード内に Infusionsoft API 呼び出しが 1 つまたは 2 つ以上ある場合は、API ヘルパー ライブラリを使用することをお勧めします。また、現在の公式のヘルパー ライブラリが機能しない場合 は、 github.comで Infusionsoft API の別のラッパーを見つけることができます。

于 2016-06-18T13:27:32.290 に答える