1

我有一些代码可以将联系人放入高层,它可以工作,直到我想添加一个标签(我知道标签 ID 和它的名称,因为它在高层中)

//URL to POST data to
 $highrise_url = 'https://user.highrisehq.com'; 
 $api_token = 'aij dadajdloiaj doiajdoiadjoaisd'; //You can find this in your Highrise account in the "my info" screen

    $curl = curl_init($highrise_url.'/people.xml');

        //Return XML don't output it
        curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);

        //Set Basic auth information
        curl_setopt($curl,CURLOPT_USERPWD,$api_token.':x'); //Username (api token, fake password as per Highrise api)

        //Setup XML to POST
        curl_setopt($curl,CURLOPT_HTTPHEADER,Array("Content-Type: application/xml"));
        curl_setopt($curl,CURLOPT_POST,true);
        curl_setopt($curl,CURLOPT_POSTFIELDS,'<person>
            <first-name>'.htmlspecialchars($request['sFirstName']).'</first-name>
            <last-name>'.htmlspecialchars($request['sLastName']).'</last-name>
            <title>Dr.</title>
            <background>'.htmlspecialchars($request['staff_comment']).'</background>
            <company-name>'.htmlspecialchars($request['sUserId']).'</company-name>
            <contact-data>
                <email-addresses>
                    <email-address>
                        <address>'.htmlspecialchars($request['sEmail']).'</address>
                        <location>Work</location>
                    </email-address>
                </email-addresses>
            <phone-numbers>
                <phone-number>
                    <number>'.htmlspecialchars($request['sPhone']).'</number>
                    <location>Home</location>
                </phone-number>
            </phone-numbers>

            <addresses> 
                <address> 
                  <city>'.htmlspecialchars($request['sCity']).'</city> 
                  <country>'.htmlspecialchars($request['Country']).'</country> 
                  <street>'.htmlspecialchars($request['sStreet']).'</street> 
                  <zip>'.htmlspecialchars($request['sPLZ']).'</zip> 
                  <location>Home</location> 
                </address> 
            </addresses>
            </contact-data>



            <subject_datas type="array">
                <subject_data>
                    <subject_field_id type="integer">926647</subject_field_id>
                    <subject_field_label>HerrFrau</subject_field_label>
                    <value>'.htmlspecialchars($request['sHerrFrau']).'</value>
                </subject_data>
            </subject_datas>
        </person>');

        //Don't verify for SSL if you have an SSL Highrise account
        curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);
        curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,0);

        //Call Highrise
        $xml = curl_exec($curl);
        curl_close($curl);      

我想补充:

        <tags type="array">
                <tag>
                <name>ebase pending</name>
                <id type="integer">3794696</id>

                </tag>
            </tags>     

现在它不再将数据保存到高层了。我现在还不够先进,无法使用其他方法来保存它。你觉得有机会这样做吗?

谢谢你的帮助,格罗

4

0 回答 0