2017-03-07 3 views
0

Ich arbeite gerade in ASP. Ich liebe es mit PHP zu programmieren, aber meine Firma benutzt ASP auf ihrer Webseite. Auf meiner Firmenwebseite gibt es ein Formular, das mit unserem CRM verbunden ist. In Bezug auf viele Spam-Nachrichten müssen wir Google Recaptcha in das Formular einfügen.Google recaptcha eine Seite auf ASP (Classic)

Unten ist PHP-Code für recaptcha, die ich für viele Website, die ich entwickelt habe, verwendet, ist es möglich, die gleiche Methode wie diesen Code auf ASP? Ich brauche nur nur eine Seite.

<?php 
if(isset($_POST['submit'])): 
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha- response'])): 
    //your site secret key 
    $secret = '6Le5ohYUAAAAAAWeXQ4TnEMsOrW7wSw4WcNUVyS7'; 
    //get verify response data 
    $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']); 
    $responseData = json_decode($verifyResponse); 

    if($responseData->success):   
     $succMsg = 'Your contact request have submitted successfully.'; 
    else: 
     $errMsg = 'Robot verification failed, please try again.'; 
    endif; 
    else: 
     $errMsg = 'Please click on the reCAPTCHA box.'; 
    endif; 
else: 
$errMsg = ''; 
$succMsg = ''; 
endif; 
?> 

<html> 
<head> 
    <title>Google reCAPTCHA</title> 
    <script src="https://www.google.com/recaptcha/api.js" async defer> </script> 
</head> 
<body> 
<div class="registration"> 
    <h2>Contact Form</h2> 
    <?php if(!empty($errMsg)): ?><div class="errMsg"><?php echo $errMsg; ?></div><?php endif; ?> 
    <?php if(!empty($succMsg)): ?><div class="succMsg"><?php echo $succMsg; ?></div><?php endif; ?> 
    <div class="form-info"> 
     <form action="" method="POST"> 
      <input type="text" class="text" value="<?php echo !empty($name)?$name:''; ?>" placeholder="Your full name" name="name" > 
      <input type="text" class="text" value="<?php echo !empty($email)?$email:''; ?>" placeholder="Email adress" name="email" > 
      <input type="text" placeholder="Message..." name="message"><?php echo !empty($message)?$message:''; ?></textarea> 
      <div class="g-recaptcha" data-sitekey="6Le5ohYUAAAAAPDz2w2tDQ-3AgYwgEQmkOhnwYhO"></div> 
      <input type="submit" name="submit" value="SUBMIT"> 
     </form> 
    </div>   
    <div class="clear"> </div> 
</div> 
</body> 
</html> 
+1

Ich stimme diese Frage als Off-Topic zu schließen, weil StackOverflow ist kein kostenloser Code-Writing-Service. – Constantin

Antwort