We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52690
    • 5 Posts
    Hi mighty All,

    I have FormIt installed, everything works fine. Now I need to create some custom hook to post form data to analytics company. This is how they offer to do that (Pastebin): http://pastebin.com/LA7GBSFE.

    This is my snippet called hook.Roistat:

    <?php
    
    $roistatData = array(
        'roistat' => isset($_COOKIE['roistat_visit']) ? $_COOKIE['roistat_visit'] : null,
        'key'     => 'KEY',
        'title'   => $hook->getValue('ticket'),
        'name'    => $hook->getValue('name'),
        'email'   => $hook->getValue('email'),
        'phone'   => $hook->getValue('telephone'),
        'is_need_callback' => '0',
    );
      
    file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));
    
    return true;
    

    This is a part of my FormIt call (on page):

    [[!FormIt?
    &hooks=`hook.Roistat,email,redirect`
    &FormFields=`name,email,telephone,ticket`
    ***SKIPPED_CODE***
    ]]
    


    It's not working. What should I do to fix it?

    Thanx!

    This question has been answered by Bruno17. See the first response.

      • 4172
      • 5,888 Posts
      did you try, if the snippet works without formit and some hardcoded values?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 52690
        • 5 Posts
        Quote from: Bruno17 at Aug 27, 2016, 03:54 PM
        did you try, if the snippet works without formit and some hardcoded values?
        No idea how to test it in a mentioned way, if you can tell me I'll appreciate your advice.
        • discuss.answer
          • 4172
          • 5,888 Posts
          Testing the snippet without formit: Create a snippet
          <?php
           
          $roistatData = array(
              'roistat' => isset($_COOKIE['roistat_visit']) ? $_COOKIE['roistat_visit'] : null,
              'key'     => 'KEY',
              'title'   => 'ticket',
              'name'    => 'name',
              'email'   => 'email',
              'phone'   => 'telephone',
              'is_need_callback' => '0',
          );
             
          $result = file_get_contents("https://cloud.roistat.com/api/proxy/1.0/leads/add?" . http_build_query($roistatData));
           
          return 'result:' . $result;


          place the snippet-call at page and view this page.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 52690
            • 5 Posts
            Thanx! Close.