{"id":1136,"date":"2020-12-27T22:22:59","date_gmt":"2020-12-27T16:52:59","guid":{"rendered":"https:\/\/myfreeonlinetools.com\/blog\/?p=1136"},"modified":"2020-12-27T22:24:40","modified_gmt":"2020-12-27T16:54:40","slug":"google-recaptcha-v3-how-to-use-in-html-php-form","status":"publish","type":"post","link":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/","title":{"rendered":"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form."},"content":{"rendered":"<p>Google reCaptcha v3 returns JSON format data. That data based on interactions with your website and validate the form submit inquiries if the submitted form inquiry is validated then it&#8217;s sent to the owner or form used scrapping then reCaptcha does not send any details to Owner with does not run the remaining script.<\/p>\n<p>Documentation of Google reCaptcha<\/p>\n<p><a href=\"https:\/\/developers.google.com\/recaptcha\/docs\/v3\">https:\/\/developers.google.com\/recaptcha\/docs\/v3<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>HTML Code &#8211; Input Form<\/p>\n<pre>&lt;form action=\"#\" method=\"post\" id=\"formAction\"&gt;\r\n&lt;div&gt;&lt;input type=\"hidden\" id=\"g-recaptcha-response\" name=\"g-recaptcha-response\" \/&gt;&lt;\/div&gt; \r\n&lt;div&gt;&lt;input type=\"text\" value=\"\" \/&gt;&lt;\/div&gt; \r\n&lt;div&gt;&lt;button id=\"submitPost\"&gt;Submit Post&lt;\/button&gt;&lt;\/div&gt; \r\n&lt;\/form&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>PHP Code &#8211; For getting JSON Response<\/p>\n<pre>&lt;?php \r\ndefine('SITE_KEY', '6Ld82pxxxxxxxxxxxxxxxxxSITExxxxKEYxxxxxxxxxx'); \r\ndefine(\"SECRET_KEY\", \"6Ld82poUxxxxxxxxSECRETxxxxxKEYxxxxxxxxxx\"); \r\n\r\nif($_POST){\r\nfunction getCaptcha($key){\r\n$response = file_get_contents(\"https:\/\/www.google.com\/recaptcha\/api\/siteverify?secret=\".SECRET_KEY.\"&amp;response={$key}\"); \r\n$return = json_decode($response);\r\nreturn $return; \r\n} \r\n\r\n$return = getCaptcha($_POST['g-recaptcha-response']);\r\n\/\/ var_dump($return);\r\nif( $return-&gt;success == true &amp;&amp; $return-&gt;score &gt; 0.5){\r\necho 'Sucess';\r\n$_SESSION[\"favcolor\"] = \"send\";\r\n}else{\r\necho 'you are robot';\r\n$_SESSION[\"favcolor\"] = \"not-send\";\r\n   }\r\n}\r\n\r\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>JavaScript Code &#8211; To Getting reCaptcha Token<\/p>\n<pre>&lt;script src=\"https:\/\/www.google.com\/recaptcha\/api.js?render=6Ld82pxxxxxxxxxxxxxxxxxSITExxxxKEYxxxxxxxxxx\"&gt;&lt;\/script&gt;\r\n&lt;script&gt;\r\ngrecaptcha.ready(function() {\r\n\/\/ do request for recaptcha token\r\n\/\/ response is promise with passed token\r\ngrecaptcha.execute('6Ld82pxxxxxxxxxxxxxxxxxSITExxxxKEYxxxxxxxxxx', {action:'send_form'})\r\n.then(function(token) {\r\n\/\/ add token value to form\r\ndocument.getElementById('g-recaptcha-response').value = token;\r\n});\r\n});\r\n&lt;\/script&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Google reCaptcha v3 returns JSON format data. That data based on interactions with your website and validate the form submit inquiries if the submitted form inquiry is validated then it&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1136","post","type-post","status-publish","format-standard","hentry","category-php"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form. - MyFreeOnlineTools<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form. - MyFreeOnlineTools\" \/>\n<meta property=\"og:description\" content=\"Google reCaptcha v3 returns JSON format data. That data based on interactions with your website and validate the form submit inquiries if the submitted form inquiry is validated then it&#8217;s [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\" \/>\n<meta property=\"og:site_name\" content=\"MyFreeOnlineTools\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/LearnSchoolOnline\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-27T16:52:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-27T16:54:40+00:00\" \/>\n<meta name=\"author\" content=\"myfreeonlinetools\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"myfreeonlinetools\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\"},\"author\":{\"name\":\"myfreeonlinetools\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c\"},\"headline\":\"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form.\",\"datePublished\":\"2020-12-27T16:52:59+00:00\",\"dateModified\":\"2020-12-27T16:54:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\"},\"wordCount\":100,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#organization\"},\"articleSection\":[\"PHP\"],\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\",\"name\":\"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form. - MyFreeOnlineTools\",\"isPartOf\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#website\"},\"datePublished\":\"2020-12-27T16:52:59+00:00\",\"dateModified\":\"2020-12-27T16:54:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#breadcrumb\"},\"inLanguage\":\"en\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/myfreeonlinetools.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#website\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/\",\"name\":\"MyFreeOnlineTools\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/myfreeonlinetools.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#organization\",\"name\":\"MyFreeOnlineTools\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png\",\"contentUrl\":\"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png\",\"width\":387,\"height\":79,\"caption\":\"MyFreeOnlineTools\"},\"image\":{\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c\",\"name\":\"myfreeonlinetools\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en\",\"@id\":\"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g\",\"caption\":\"myfreeonlinetools\"},\"description\":\"Live in Delhi, Working in Gurgaon as Web Designer and Graphic Designer. Developed and Design myfreeonlinetools for online free tools. Also having youtube channel Name with LearnSchoolOnline. Traveling, watching movies, coding are the hobbies.\",\"sameAs\":[\"https:\/\/myfreeonlinetools.com\/\",\"https:\/\/www.facebook.com\/LearnSchoolOnline\/\",\"https:\/\/www.youtube.com\/learnschoolonline\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form. - MyFreeOnlineTools","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/","og_locale":"en_US","og_type":"article","og_title":"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form. - MyFreeOnlineTools","og_description":"Google reCaptcha v3 returns JSON format data. That data based on interactions with your website and validate the form submit inquiries if the submitted form inquiry is validated then it&#8217;s [&hellip;]","og_url":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/","og_site_name":"MyFreeOnlineTools","article_author":"https:\/\/www.facebook.com\/LearnSchoolOnline\/","article_published_time":"2020-12-27T16:52:59+00:00","article_modified_time":"2020-12-27T16:54:40+00:00","author":"myfreeonlinetools","twitter_card":"summary_large_image","twitter_misc":{"Written by":"myfreeonlinetools","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#article","isPartOf":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/"},"author":{"name":"myfreeonlinetools","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c"},"headline":"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form.","datePublished":"2020-12-27T16:52:59+00:00","dateModified":"2020-12-27T16:54:40+00:00","mainEntityOfPage":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/"},"wordCount":100,"commentCount":0,"publisher":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#organization"},"articleSection":["PHP"],"inLanguage":"en","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/","url":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/","name":"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form. - MyFreeOnlineTools","isPartOf":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#website"},"datePublished":"2020-12-27T16:52:59+00:00","dateModified":"2020-12-27T16:54:40+00:00","breadcrumb":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#breadcrumb"},"inLanguage":"en","potentialAction":[{"@type":"ReadAction","target":["https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/myfreeonlinetools.com\/blog\/google-recaptcha-v3-how-to-use-in-html-php-form\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/myfreeonlinetools.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Google reCAPTCHA v3, How to use validation of HTML JQuery PHP Form."}]},{"@type":"WebSite","@id":"https:\/\/myfreeonlinetools.com\/blog\/#website","url":"https:\/\/myfreeonlinetools.com\/blog\/","name":"MyFreeOnlineTools","description":"","publisher":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/myfreeonlinetools.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en"},{"@type":"Organization","@id":"https:\/\/myfreeonlinetools.com\/blog\/#organization","name":"MyFreeOnlineTools","url":"https:\/\/myfreeonlinetools.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png","contentUrl":"https:\/\/myfreeonlinetools.com\/blog\/wp-content\/uploads\/2019\/11\/myfreeonlinetools-blue.png","width":387,"height":79,"caption":"MyFreeOnlineTools"},"image":{"@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/b1eb72e57c554e3b33cfeec477efcc3c","name":"myfreeonlinetools","image":{"@type":"ImageObject","inLanguage":"en","@id":"https:\/\/myfreeonlinetools.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b870b17c6c7e3b75d7fe0b8bebfc9cf5?s=96&d=mm&r=g","caption":"myfreeonlinetools"},"description":"Live in Delhi, Working in Gurgaon as Web Designer and Graphic Designer. Developed and Design myfreeonlinetools for online free tools. Also having youtube channel Name with LearnSchoolOnline. Traveling, watching movies, coding are the hobbies.","sameAs":["https:\/\/myfreeonlinetools.com\/","https:\/\/www.facebook.com\/LearnSchoolOnline\/","https:\/\/www.youtube.com\/learnschoolonline"]}]}},"_links":{"self":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/comments?post=1136"}],"version-history":[{"count":0,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/1136\/revisions"}],"wp:attachment":[{"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/media?parent=1136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/categories?post=1136"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myfreeonlinetools.com\/blog\/wp-json\/wp\/v2\/tags?post=1136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}