• Hi

    We are using contact form 7 on a clients site

    The client has asked us to create REST calls of any received mails to an outside api

    We found the plug in Contact form 7 to REST call which seemed to be exactly what we were looking for

    The plug in instructs the user to configure a page of code to make the calls ( see below)

    <?php
    class Conf
    {
    const cf7RESThost=’mydoimain.com’;
    const cf7RESTport=’90’;
    const cf7RESTmethod=”POST”;
    const cf7RESTpath = ‘http://mydoimain.com/api/something&#8217;;

    /*BODY {tag-names-to-auto-replace}*/
    public static function GeBody()
    {
    $cf7RESTparams=
    <<<BODY
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <data>
    <lead>
    <key></key>
    <leadgroup></leadgroup>
    <firstname></firstname>
    <lastname></lastname>
    <site></site>
    <introducer></introducer>
    <type></type>
    <user></user>
    <status></status>
    <reference></reference>
    <source></source>
    <medium></medium>
    <term></term>
    <cost></cost>
    <value></value>
    <title></title>
    <company></company>
    <jobtitle></jobtitle>
    <phone1></phone1>
    <phone2></phone2>
    <fax></fax>
    <email></email>
    <address></address>
    <address2></address2>
    <address3></address3>
    <towncity></towncity>
    <postcode></postcode>
    <dobday></dobday>
    <dobmonth></dobmonth>
    <dobyear></dobyear>
    <contactphone></contactphone>
    <contactfax></contactfax>
    <contactemail></contactemail>
    <contactmail></contactmail>
    <contacttime></contacttime>
    <data1></data1>
    </lead>
    </data>
    BODY;

    return $cf7RESTparams;
    }

    }
    ?>

    But we have tried recoding slightly to someting more like what the api server is anticipating

    <?php
    class Conf
    {
    const cf7RESThost=’pastiche.org.uk’;
    const cf7RESTport=’90’;
    const cf7RESTmethod=”POST”;
    const cf7RESTpath = ‘http://54.74.140.148/services/contacts/
    ‘;

    /*BODY {tag-names-to-auto-replace}*/
    public static function GeBody()
    {
    $cf7RESTparams=
    <<<BODY
    <contact>
    <contactEmail>{your-email}</contactEmail>
    <contactName>{your-name}</contactName>
    <contactTelephone>{Telephone}</contactTelephone>
    <notes>{your-message}</notes>
    </contact>
    BODY;

    return $cf7RESTparams;
    }

    }
    ?>

    But the info passed in the call just replicates the { } placeholders we set an not the actual content of any of the emails

    Any suggestions anyone? thanks in adavnce

The topic ‘REST call configuration advice needed’ is closed to new replies.