'; return $content; } /** * Subscribe from WPCF Forms after the email has been sent * * @param array $args * @return mixed */ function subscribe_from_cf7($args=null) { $sendyUrl = "https://thechakrapalace.com/news/subscribe"; // api_key $sendyApiKey = "coSgjnh2jpf3UTmIWPJP"; try { if (!isset($_POST['sendy_list_id'])) { throw new Exception("Missing sendy_list_id"); } $postdata = http_build_query([ 'name' => $_POST['sub-name'], 'email' => $_POST['sub-email'], 'api_key' => $sendyApiKey, 'list' => $_POST['sendy_list_id'], 'boolean' => 'true' ]); $opts = ['http' => [ 'method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata ]]; $context = stream_context_create($opts); $result = file_get_contents($sendyUrl, false, $context); if (!$result) { throw new Exception("There was a problem adding you to the mailing list"); } } catch (Exception $e) { echo ""; } } Articles Archives - DivorcingSecrets.com