Hi, I am using this recaptcha script I have found on Github (https://github.com/JoelLisenby/recaptcha) and what I would like to do is create a simple php function that I can call each time but I am unable to achieve this because my mind has gone blank for around 10 mins now so I was wondering if it is actually possible! As shown in the code below its a functon called recaptcha that I can keep calling but then with the class as its got $recaptcha->button() am I right in thinking you cant call it from the function and can you please show me what I’m doing wrong!
<?php
require_once '../vendor/recaptcha/recaptcha.php';
function recaptcha($form_id, $site_key, $secret_key)
{
$recaptcha = new Recaptcha($form_id, $site_key, $secret_key);
return $recaptcha;
}
I don’t see the real problem, because your code is doing absolutely nothing. You are not calling the method you are talking about and you do not even call the function anywhere.
haha thanks, after I posted it the next day I realised what an odd question it was seeing as I use the function() for things that I need on hand always but with recaptcha I clearly don’t so I just adapted the class from github to meet my needs and now it works great! Never even needed a function()