Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Create Sendy html code + google recaptcha for website homepage
  • I've tried posting a job request on Fiverr and haven't had much luck. I run an ecommerce store and am looking to add my sendy sign up form to the homepage. I also want Google Recaptcha since the last time we put a form without recaptcha it got bombarded by SPAM bots. I already registered my site with recaptcha and am using it with my stores built in contact form but I want to use it with Sendy's contact form code.

    Anyone know how to do this or would be willing to do this for like $50.00. I know it's not a huge job and fairly simple but I just don't know how to do it.

  • Vote Up0Vote Down smilesmile
    Posts: 1Sendy user

    I am very much interested if some one is willing to share the code for this..... Recenty im spammed like hell and a reCAPTCHA is really needed. I think everyone can use this maybe integrate this in Sendy?

  • Hi I have yet to get Sendy working but the following should work:

    Step 1 register a domain and grab site key and secret key

    Step 2 Modify the following php page to suit yourself. We are using the sendy api here.

    //-------------------------- All these need to be set ------------------------//
    $recaptcha_secret = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // Your recapture secret key
    $your_installation_url = ''; //Your Sendy installation (without the trailing slash)
    $list = 'ccccccccccccccccccccccccccccccccccccccc'; //Can be retrieved from "View all lists" page
    $success_url = ''; //URL user will be redirected to if successfully subscribed

    $response = file_get_contents("".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']);
    $response = json_decode($response, true);
    if($response["success"] === true)
    //POST variables
    $name = $_POST['name'];
    $email = $_POST['email'];
    $boolean = 'true';
    $postdata = http_build_query(
    'name' => $name,
    'email' => $email,
    'list' => $list,
    'boolean' => 'true'
    $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
    $context = stream_context_create($opts);
    $result = file_get_contents($your_installation_url.'/subscribe', false, $context);

    //Should really check result contents before redirect
    header("Location: $success_url");
    echo "<center>You are possibly a robot</center>";
    <!doctype html>
    <title>Sendy reCAPTCHA demo</title>
    <script src=''></script&gt;
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" accept-charset="utf-8">
    <label for="name">Name</label>
    <input type="text" name="name" required /><br/>
    <label for="email">Email</label>
    <input type="text" name="email" required /><br/>
    <!-- The recapture site key needs to be set -->
    <div class="g-recaptcha" data-sitekey="eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"></div>
    <input type="submit" value="Let Me In!" />

This discussion has been closed.
All Discussions