lee_sov Posted October 19, 2015 Author Share Posted October 19, 2015 So removing the IP key/value pair made no difference but dont need this anyway so might as well leave it out! The output of the phpinfo is as below, - assume this means openssl is installed? curl cURL support enabled cURL Information libcurl/7.20.0 OpenSSL/0.9.8q zlib/1.2.3 could this issue be something to do with the code in my contact.php? script src="https://www.google.com/recaptcha/api.js" async defer></script> <form name="contact" action="submit.php" method="post"> <fieldset class="conform"> <legend>Your Details</legend><br /> <label for="name">Name</label> <input id="name" type="text" size="40" value="<?php echo (isset($_POST["name"])) ? $_POST["name"] : '' ; ?>" name="name" /> <span class="red">**</span><br /> <label for="company">Company</label> <input id="company" type="text" size="40" value="<?php echo (isset($_POST["company"])) ? $_POST["company"] : '' ; ?>" name="company" /><br /> <label for="telephone">Telephone</label> <input id="telephone" type="text" size="40" value="<?php echo (isset($_POST["telephone"])) ? $_POST["telephone"] : ''; ?>" name="telephone" /><br /> <label for="email">Email Address</label> <input id="email" type="text" size="40" value="<?php echo (isset($_POST["email"])) ? $_POST["email"] : ''; ?>" name="email" /> <span class="red">**</span><br /> </fieldset> <fieldset class="conform2"> <legend>Further Information</legend><br /> <textarea id="comments" name="comments" size="40" rows="8" cols="50"><?php echo(isset($_POST["comments"])) ? $_POST["comments"] : '' ; ?></textarea> </fieldset> <html> <div class="g-recaptcha" data-sitekey="my key"></div><br> <br /> <a href="javascript:document.contact.submit();"><img title="" height="43" alt="" src="images/submit.gif" width="102" border="0" /></a> </form> </div> <?php } else { ?> <p>Thank you for your enquiry. We will reply as soon as possible.</p> <?php } ?> Quote Link to comment Share on other sites More sharing options...
lee_sov Posted October 26, 2015 Author Share Posted October 26, 2015 any updates or further help on this guys? Quote Link to comment Share on other sites More sharing options...
printf Posted October 26, 2015 Share Posted October 26, 2015 Could you try this code... if I recall, curl 7.20.*, and 7.21.* has problems with CURLOPT_POST | CURLOPT_POSTFIELDS if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) { if( isset ( $_POST['g-recaptcha-response'] ) && ! empty ( $_POST['g-recaptcha-response'] ) ) { $key = 'my key'; $rip = $_SERVER['REMOTE_ADDR']; $captchaurl = 'https://www.google.com/recaptcha/api/siteverify?'; $captchaurl .= 'secret=' . $key . '&'; $captchaurl .= 'response=' . $_POST['g-recaptcha-response'] . '&'; $captchaurl .= 'ip=' . $rip; $curl_init = curl_init (); curl_setopt ( $curl_init, CURLOPT_URL, $captchaurl ); curl_setopt ( $curl_init, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $curl_init, CURLOPT_TIMEOUT, 5 ); curl_setopt ( $curl_init, CURLOPT_USERAGENT, 'PHP/reCAPTCHA' ); curl_setopt ( $curl_init, CURLOPT_SSL_VERIFYPEER, FALSE ); $response = curl_exec ( $curl_init ); if ( $response == FALSE ) { echo '<p>Curl Error: ' . curl_error ( $curl_init ); } else { $result = json_decode ( $response, TRUE ); echo 'Recaptha Result: '; var_dump ( $result['success'] ); } curl_close ( $curl_init ); } } Quote Link to comment Share on other sites More sharing options...
lee_sov Posted October 28, 2015 Author Share Posted October 28, 2015 Thanks Prinf, I have tried the above code, but as soon as I click to submit the form, all i receive is a message saying Curl Error: I cant understand why this isn't outputting correctly or getting the success response back from the form! Quote Link to comment Share on other sites More sharing options...
lee_sov Posted October 29, 2015 Author Share Posted October 29, 2015 Im now receiving the following result: Curl Response: string(21) "{ "success": true }" Recaptha Result: bool(true) any ideas what this means? Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 29, 2015 Share Posted October 29, 2015 (edited) That will mean the code given by printf is successfully resolving the google recaptha. Edited October 29, 2015 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
lee_sov Posted October 30, 2015 Author Share Posted October 30, 2015 So its resolving the recaptcha sucessfully so whats the nerxt step to get it working, as the E-mail is still not sent & I just get this message on the screen every time? Thanks Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 30, 2015 Share Posted October 30, 2015 Replace echo 'Recaptha Result: '; var_dump ( $result['success'] ); With your code for sending the emails. Quote Link to comment Share on other sites More sharing options...
lee_sov Posted October 30, 2015 Author Share Posted October 30, 2015 Sorry, which part in my code is the bit that actually sends the E-mail? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.