{"id":19671,"date":"2026-11-19T01:28:54","date_gmt":"2026-11-18T19:58:54","guid":{"rendered":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/"},"modified":"2026-11-19T02:04:46","modified_gmt":"2026-11-18T20:34:46","slug":"otp-widget-php-hosting-fast2sms","status":"publish","type":"post","link":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/","title":{"rendered":"PHP OTP verification on cPanel or shared hosting (Fast2SMS OTP widget)"},"content":{"rendered":"<p>This guide adds PHP OTP verification to a site on cPanel or any shared hosting, with no Composer and no framework. The whole backend is one file, <code>f2s-otp.php<\/code>. You upload it with the widget script, add two lines of HTML, and visitors can verify their mobile number by SMS or WhatsApp before they log in or submit a form.<\/p>\n<aside class=\"f2s-cta\" aria-label=\"Get started with Fast2SMS\"><div class=\"f2s-cta__copy\"><strong class=\"f2s-cta__title\">Verify mobile numbers on your PHP site<\/strong><p>Create a Smart OTP template, copy the OTP ID and upload one PHP file.<\/p><\/div><div class=\"f2s-cta__actions\"><a class=\"f2s-cta__btn f2s-cta__btn--primary\" href=\"https:\/\/www.fast2sms.com\/\"><span>Sign up free<\/span> <span class=\"f2sh-btn__arrow\" aria-hidden=\"true\">&rarr;<\/span><\/a><a class=\"f2s-cta__btn f2s-cta__btn--ghost\" href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Book a free meeting<\/a><\/div><\/aside>\n<p class=\"f2s-kit-wrap\"><a class=\"f2s-kit\" href=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/fast2sms-otp-widget-php-single-file.zip\" download><svg class=\"f2s-kit__icon\" width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path fill=\"#7F56D9\" d=\"M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z\"\/><path fill=\"#FFFFFF\" d=\"M14 2v6h6\"\/><path fill=\"#FFFFFF\" d=\"M9 6h2v2H9zm2 2h2v2h-2zM9 10h2v2H9zm2 2h2v2h-2zm-2 2h4v4H9z\"\/><rect x=\"10\" y=\"15.4\" width=\"2\" height=\"1.6\" fill=\"#7F56D9\"\/><\/svg><span class=\"f2s-kit__text\"><strong>Download the PHP OTP widget kit (zip)<\/strong><span class=\"f2s-kit__meta\">fast2sms-otp-widget-php-single-file.zip &middot; 49 KB<\/span><\/span><span class=\"f2s-kit__btn\">Download .zip<\/span><\/a><\/p>\n<div class=\"f2s-note\">We tested this kit with PHP 8.4.22 against a mock copy of the Fast2SMS API, so no real SMS was sent: 47 of 47 browser and API checks and 32 of 32 unit tests passed.<\/div>\n<h2>Before you start<\/h2>\n<ul>\n<li>A Fast2SMS account with wallet balance. Every send and resend is charged.<\/li>\n<li>For SMS OTP: an approved DLT entity, sender ID and OTP content template in <strong>DLT Manager<\/strong>. For WhatsApp OTP: a connected WhatsApp number with an approved Authentication or Utility template.<\/li>\n<li>PHP 8.1 or newer with the <code>curl<\/code> extension. Most PHP hosting has both.<\/li>\n<li>Access to your hosting files (cPanel File Manager or FTP).<\/li>\n<\/ul>\n<h2>Set up PHP OTP verification in 6 steps<\/h2>\n<ol class=\"f2s-steps\">\n<li>\n<h3>Create a Smart OTP template and copy its OTP ID<\/h3>\n<p>In the panel, open <strong>Smart OTP<\/strong> &gt; <strong>OTP Template List<\/strong> and click <strong>Add OTP Template<\/strong>. On the <strong>SMS Channel<\/strong> tab, pick your DLT entity, sender and approved OTP template, then click the variable that should carry the code. For WhatsApp, use the <strong>WhatsApp Channel<\/strong> tab with an approved Authentication or Utility template. Tick <strong>SET FALLBACK TEMPLATE<\/strong> if you want the other channel as a backup, then click <strong>Assign OTP Template<\/strong>.<\/p>\n<p>Copy the 10-character <strong>OTP ID<\/strong> from the new card. It decides the channel, the template and the fallback for every code the widget sends. Use <strong>Test OTP<\/strong> on the card to check that the template sends.<\/p>\n<figure class=\"f2s-shot\"><img src=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp\" width=\"1440\" height=\"900\" loading=\"lazy\" decoding=\"async\" alt=\"Add OTP Template window on the SMS Channel tab with entity, sender and DLT template chosen and Variable 1 selected\"><figcaption>Pick the entity, sender and DLT template, then the variable that carries the OTP.<\/figcaption><\/figure>\n<\/li>\n<li>\n<h3>Copy your API key<\/h3>\n<p>Under <strong>Utility<\/strong> in the left menu, click <strong>API Key<\/strong>. Click <strong>View<\/strong> (the panel first asks for an OTP sent to your registered mobile) and copy the <strong>Authorization Key<\/strong>. Check that <strong>API Access<\/strong> is switched on. This key will live only in your backend&#8217;s settings, never in a page or an app.<\/p>\n<figure class=\"f2s-shot\"><img src=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/api-key-hd-33-scaled.webp\" width=\"1440\" height=\"900\" loading=\"lazy\" decoding=\"async\" alt=\"API Key page with the masked Authorization Key, View and Reset buttons and the API Access switch turned on\"><figcaption>Copy the Authorization Key. API Access must be on.<\/figcaption><\/figure>\n<\/li>\n<li>\n<h3>Fill in the settings file<\/h3>\n<p>Unzip the kit. Copy <code>f2s-otp-config.sample.php<\/code> to <code>f2s-otp-config.php<\/code> and fill in the three required values. Make the secret with <code>php -r \"echo bin2hex(random_bytes(32));\"<\/code>, or use any other 32 or more random characters.<\/p>\n<pre><code class=\"language-php\">return [\n    'FAST2SMS_API_KEY' =&gt; 'YOUR_API_KEY',\n    'F2S_OTP_ID'       =&gt; 'YOUR_OTP_ID',\n    'F2S_TOKEN_SECRET' =&gt; 'paste 64 random characters here',\n    \/\/ optional limits, defaults shown\n    'F2S_RESEND_WAIT'      =&gt; 30,\n    'F2S_LIMIT_PER_NUMBER' =&gt; 5,\n    'F2S_LIMIT_PER_IP'     =&gt; 20,\n    'F2S_MAX_VERIFY'       =&gt; 5,\n];<\/code><\/pre>\n<p>Put <code>f2s-otp-config.php<\/code> <strong>one folder above your web root<\/strong> if your host allows it, for example next to <code>public_html<\/code>, so nobody can download it. <code>f2s-otp.php<\/code> looks there first, then in its own folder. Environment variables with the same names also work.<\/p>\n<\/li>\n<li>\n<h3>Upload two files<\/h3>\n<p>Upload <code>public\/f2s-otp.php<\/code> and <code>public\/f2s-otp-widget.min.js<\/code> to your web root (usually <code>public_html<\/code>). If you have a shell, check the settings with <code>php f2s-otp.php check<\/code>. Without a shell, a missing setting makes every request fail, and your PHP error log names the setting.<\/p>\n<\/li>\n<li>\n<h3>Add the widget to a page<\/h3>\n<p>Paste these two lines into any page, where the box should appear:<\/p>\n<pre><code class=\"language-html\">&lt;script src=\"\/f2s-otp-widget.min.js\" defer&gt;&lt;\/script&gt;\n&lt;div data-f2s-otp data-endpoint=\"\/f2s-otp.php\"&gt;&lt;\/div&gt;<\/code><\/pre>\n<figure class=\"f2s-shot\"><img src=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/otp-widget-code-step-2x-5.webp\" width=\"388\" height=\"360\" loading=\"lazy\" decoding=\"async\" alt=\"The OTP widget after Send OTP: six code boxes, a Verify button and a Resend code timer\"><figcaption>After Send OTP the visitor sees the code boxes and a resend timer.<\/figcaption><\/figure>\n<\/li>\n<li>\n<h3>Check the token in your form handler<\/h3>\n<p>After a correct code, the widget gives your page a signed token. To make a form wait for OTP, add <code>data-f2s-protect data-endpoint=\"\/f2s-otp.php\"<\/code> to the <code>&lt;form&gt;<\/code>; the widget then adds a hidden <code>f2s_token<\/code> field. In the PHP file that receives the form, check it before you save anything:<\/p>\n<pre><code class=\"language-php\">require __DIR__ . '\/f2s-otp.php';\n\n$v = \\F2sOtp\\verify_token($_POST['f2s_token'] ?? '', $_POST['phone'] ?? null);\nif ($v === null) {\n    http_response_code(403);\n    exit('Mobile number not verified.');\n}\n\/\/ $v['mobile'] is the verified 10-digit number. A token works only once.<\/code><\/pre>\n<p><code>public\/demo-signup.php<\/code> in the kit is a complete example handler.<\/p>\n<\/li>\n<\/ol>\n<h2>Try it on your computer first<\/h2>\n<p>In the kit folder, start PHP&#8217;s built-in server and open <code>http:\/\/127.0.0.1:8000<\/code>. The demo page has a login box and a protected sign-up form.<\/p>\n<pre><code class=\"language-bash\">php -S 127.0.0.1:8000 -t public<\/code><\/pre>\n<p>To test without sending real SMS, run the fake Fast2SMS server in the <code>mock<\/code> folder (it needs Python 3; the right code is always <code>123456<\/code>) and set <code>FAST2SMS_BASE_URL=http:\/\/127.0.0.1:4010<\/code>, <code>FAST2SMS_API_KEY=TEST_KEY_OK<\/code> and <code>F2S_OTP_ID=a1b2c3d4e5<\/code>. Remove <code>FAST2SMS_BASE_URL<\/code> before you go live.<\/p>\n<aside class=\"f2s-cta\" aria-label=\"Get started with Fast2SMS\"><div class=\"f2s-cta__copy\"><strong class=\"f2s-cta__title\">Get your Smart OTP ID<\/strong><p>Add an SMS or WhatsApp OTP template with fallback and copy its OTP ID into the config file.<\/p><\/div><div class=\"f2s-cta__actions\"><a class=\"f2s-cta__btn f2s-cta__btn--primary\" href=\"https:\/\/www.fast2sms.com\/\"><span>Sign up free<\/span> <span class=\"f2sh-btn__arrow\" aria-hidden=\"true\">&rarr;<\/span><\/a><a class=\"f2s-cta__btn f2s-cta__btn--ghost\" href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Book a free meeting<\/a><\/div><\/aside>\n<h2>Good to know on shared hosting<\/h2>\n<ul>\n<li><strong>Limits are kept in small files<\/strong> in the system temp folder. To use another folder, set <code>F2S_STORE_DIR<\/code>. With several servers behind a load balancer, give them a shared folder.<\/li>\n<li><strong>Cloudflare or another proxy in front of your site:<\/strong> set <code>F2S_TRUST_PROXY<\/code> to <code>1<\/code>, so the per-IP limit sees the visitor&#8217;s IP and not the proxy&#8217;s. Do not set it otherwise.<\/li>\n<li><strong>API Security:<\/strong> if it is switched on in your account, add your hosting server&#8217;s outgoing IP address to the whitelist, or Fast2SMS refuses the key. See <a href=\"\/help\/api-security-ip-whitelist\/\">how to whitelist IP addresses<\/a>.<\/li>\n<li><strong>Another domain:<\/strong> if a page on a different domain uses this backend, add that origin to <code>F2S_ALLOWED_ORIGINS<\/code>.<\/li>\n<li><strong>Logs<\/strong> go to PHP&#8217;s error log. They show <code>98xxxxxx10<\/code>, never the full number, the OTP or the key.<\/li>\n<\/ul>\n<h2>How sending works<\/h2>\n<p>The widget posts JSON to <code>f2s-otp.php<\/code> with one of three actions: <code>send<\/code>, <code>verify<\/code> or <code>resend<\/code>. The file checks the page&#8217;s origin, the resend wait and the limits, then calls Fast2SMS Smart OTP with your key in the <code>authorization<\/code> header. Fast2SMS makes a 6-digit code that is valid for 15 minutes, unless you set <code>F2S_OTP_LENGTH<\/code> or <code>F2S_OTP_EXPIRY<\/code>. A new code for a number cancels the older one.<\/p>\n<p><strong>Resend<\/strong> sends the same code again, it does not make a new one. Fast2SMS allows it within 10 minutes of the first send, and up to 5 sends to one number in that time, counting the first.<\/p>\n<p>Every send and every resend is charged at your Smart OTP rate, and a fallback message on the second channel is charged too. Verify is free. The <strong>Test OTP<\/strong> button on a template card is also a real, charged send. See the current rates on the <a href=\"https:\/\/www.fast2sms.com\/otp-sms\">OTP SMS page<\/a>.<\/p>\n<div class=\"f2s-note f2s-volume\"><p><strong>Sending in bulk?<\/strong> For high OTP volumes our team offers discounted rates. <a href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Talk to our team<\/a> or see <a href=\"https:\/\/www.fast2sms.com\/bulk-sms-pricing\">OTP pricing<\/a>.<\/p><\/div>\n<h2>Common problems and fixes<\/h2>\n<div class=\"f2s-facts\">\n<table>\n<thead>\n<tr>\n<th>What you see<\/th>\n<th>Why<\/th>\n<th>Fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Every request fails and the log lists settings<\/td>\n<td>A required setting is missing or wrong<\/td>\n<td>Set <code>FAST2SMS_API_KEY<\/code>, <code>F2S_OTP_ID<\/code> (10 characters) and <code>F2S_TOKEN_SECRET<\/code> (32 or more).<\/td>\n<\/tr>\n<tr>\n<td>&#8220;We could not send the code right now.&#8221;<\/td>\n<td>An account or setup problem. Your server log names it: <code>failed reason=...<\/code><\/td>\n<td><code>invalid_otp_id<\/code>: copy the OTP ID again, from the same account as the key. <code>insufficient_balance<\/code>: recharge with <strong>Add Amount<\/strong>. <code>template_inactive<\/code>: create a new OTP template. Auth error: check the key, switch on <strong>API Access<\/strong>, or whitelist the server IP in <strong>API Security<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td>&#8220;This page is not allowed to use this OTP service.&#8221;<\/td>\n<td>The page is on another domain<\/td>\n<td>Add its origin (<code>https:\/\/<\/code> plus the domain, no path) to <code>F2S_ALLOWED_ORIGINS<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>&#8220;Please wait N seconds&#8230;&#8221;<\/td>\n<td>The resend wait: the widget&#8217;s own, or Fast2SMS&#8217;s<\/td>\n<td>Wait. Change <code>F2S_RESEND_WAIT<\/code>, or <strong>SMS Resend \/ Time Limit<\/strong> in <strong>OTP Settings<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td>&#8220;Too many requests&#8221;<\/td>\n<td>The per-number or per-IP limit was hit<\/td>\n<td>Wait an hour, or raise <code>F2S_LIMIT_PER_NUMBER<\/code> \/ <code>F2S_LIMIT_PER_IP<\/code>.<\/td>\n<\/tr>\n<tr>\n<td>The code never arrives<\/td>\n<td>Sent is not the same as delivered<\/td>\n<td>Check <strong>Smart OTP<\/strong> &gt; <strong>Delivery Report<\/strong>, and use <strong>Test OTP<\/strong> on the template card.<\/td>\n<\/tr>\n<tr>\n<td>Your form handler says &#8220;not verified&#8221;<\/td>\n<td>The token is missing, was used already, is older than 10 minutes, or is for another number<\/td>\n<td>Verify again. Check the token once, when the form is submitted.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<section class=\"f2s-faq\">\n<h2>Frequently asked questions<\/h2>\n<h3>Does this PHP OTP kit need Composer or a framework?<\/h3>\n<p>No. It is one PHP file that needs PHP 8.1 or newer with curl. It runs on cPanel, other shared hosting and a VPS.<\/p>\n<h3>Where do I keep the API key on shared hosting?<\/h3>\n<p>In <code>f2s-otp-config.php<\/code>, one folder above <code>public_html<\/code> if your host allows it. Never put the key in an HTML or JavaScript file.<\/p>\n<h3>Can I use the widget on a WordPress site on the same hosting?<\/h3>\n<p>Use the WordPress plugin kit instead. It runs the same PHP code inside WordPress and adds the <code>&#091;f2s_otp&#093;<\/code> shortcode.<\/p>\n<h3>I want a full OTP login page, not a box. Which kit?<\/h3>\n<p>Use the <a href=\"\/help\/otp-login-php-fast2sms\/\">PHP OTP login starter kit<\/a>. It is a complete login page with sessions. The widget is for adding a verify step to pages you already have.<\/p>\n<h3>Why does the visitor see a general error when my balance is low?<\/h3>\n<p>On purpose. Visitors see a neutral message for account problems. The real reason, such as <code>insufficient_balance<\/code>, is in your PHP error log.<\/p>\n<h3>Is verify charged?<\/h3>\n<p>No. Sends and resends are charged; verify is free.<\/p>\n<\/section>\n<aside class=\"f2s-cta\" aria-label=\"Get started with Fast2SMS\"><div class=\"f2s-cta__copy\"><strong class=\"f2s-cta__title\">Start with Fast2SMS Smart OTP<\/strong><p>Sign up, recharge your wallet and add OTP verification to your PHP site today.<\/p><\/div><div class=\"f2s-cta__actions\"><a class=\"f2s-cta__btn f2s-cta__btn--primary\" href=\"https:\/\/www.fast2sms.com\/\"><span>Sign up free<\/span> <span class=\"f2sh-btn__arrow\" aria-hidden=\"true\">&rarr;<\/span><\/a><a class=\"f2s-cta__btn f2s-cta__btn--ghost\" href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Book a free meeting<\/a><\/div><\/aside>\n<h2>Related guides<\/h2>\n<ul>\n<li><a href=\"\/help\/otp-login-php-fast2sms\/\">OTP login in PHP with Fast2SMS (starter kit)<\/a><\/li>\n<li><a href=\"\/help\/smart-otp-setup-guide-fast2sms\/\">Smart OTP in Fast2SMS: set up OTP on SMS and WhatsApp<\/a><\/li>\n<li><a href=\"\/help\/api-key-find-reset\/\">How to find, view and reset your Fast2SMS API key<\/a><\/li>\n<li><a href=\"\/help\/api-security-ip-whitelist\/\">How to whitelist IP addresses for the Fast2SMS API<\/a><\/li>\n<li><a href=\"\/help\/otp-verification-signup-form\/\">OTP verification for signup forms<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This guide adds PHP OTP verification to a site on cPanel or any shared hosting, with no Composer and no framework. The whole backend is one file, f2s-otp.php. You upload it with the widget script, add two lines of HTML, and visitors can verify their mobile number by SMS or WhatsApp before they log in [&hellip;]<\/p>\n","protected":false},"featured_media":19664,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-19671","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api","category-otp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PHP OTP Verification on cPanel Hosting | Fast2SMS<\/title>\n<meta name=\"description\" content=\"Add PHP OTP verification to any cPanel or shared hosting site with one file and two lines of HTML. SMS and WhatsApp OTP with Fast2SMS Smart OTP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP OTP Verification on cPanel Hosting | Fast2SMS\" \/>\n<meta property=\"og:description\" content=\"Add PHP OTP verification to any cPanel or shared hosting site with one file and two lines of HTML. SMS and WhatsApp OTP with Fast2SMS Smart OTP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/\" \/>\n<meta property=\"og:site_name\" content=\"Fast2SMS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Fast2SMS\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-18T19:58:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-18T20:34:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fast2sms\" \/>\n<meta name=\"twitter:site\" content=\"@fast2sms\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/\"},\"author\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\"},\"headline\":\"PHP OTP verification on cPanel or shared hosting (Fast2SMS OTP widget)\",\"datePublished\":\"2026-11-18T19:58:54+00:00\",\"dateModified\":\"2026-11-18T20:34:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/\"},\"wordCount\":1432,\"publisher\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-add-sms-filled-hd-11-scaled.webp\",\"articleSection\":[\"API\",\"OTP\"],\"inLanguage\":\"en-IN\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/\",\"name\":\"PHP OTP Verification on cPanel Hosting | Fast2SMS\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-add-sms-filled-hd-11-scaled.webp\",\"datePublished\":\"2026-11-18T19:58:54+00:00\",\"dateModified\":\"2026-11-18T20:34:46+00:00\",\"description\":\"Add PHP OTP verification to any cPanel or shared hosting site with one file and two lines of HTML. SMS and WhatsApp OTP with Fast2SMS Smart OTP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#breadcrumb\"},\"inLanguage\":\"en-IN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-IN\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-add-sms-filled-hd-11-scaled.webp\",\"contentUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-add-sms-filled-hd-11-scaled.webp\",\"width\":2560,\"height\":1600,\"caption\":\"Add OTP Template window on the SMS Channel tab with entity, sender and DLT template chosen and Variable 1 selected\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-php-hosting-fast2sms\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"API\",\"item\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/api\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP OTP verification on cPanel or shared hosting (Fast2SMS OTP widget)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/#website\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/\",\"name\":\"Fast2SMS\",\"description\":\"Help\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\"},\"inLanguage\":\"en-IN\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\",\"name\":\"Fast2SMS\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#logo\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/Fast2SMS.png\",\"contentUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/Fast2SMS.png\",\"caption\":\"Fast2SMS\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#logo\"},\"email\":\"support@fast2sms.com\",\"telephone\":\"+91-6262778822\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Fast2SMS\",\"https:\\\/\\\/www.instagram.com\\\/fast2sms\",\"https:\\\/\\\/x.com\\\/fast2sms\",\"https:\\\/\\\/www.youtube.com\\\/Fast2SMSofficial\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/fast2sms\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PHP OTP Verification on cPanel Hosting | Fast2SMS","description":"Add PHP OTP verification to any cPanel or shared hosting site with one file and two lines of HTML. SMS and WhatsApp OTP with Fast2SMS Smart OTP.","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:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/","og_locale":"en_US","og_type":"article","og_title":"PHP OTP Verification on cPanel Hosting | Fast2SMS","og_description":"Add PHP OTP verification to any cPanel or shared hosting site with one file and two lines of HTML. SMS and WhatsApp OTP with Fast2SMS Smart OTP.","og_url":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/","og_site_name":"Fast2SMS","article_publisher":"https:\/\/www.facebook.com\/Fast2SMS\/","article_published_time":"2026-11-18T19:58:54+00:00","article_modified_time":"2026-11-18T20:34:46+00:00","og_image":[{"width":2560,"height":1600,"url":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_creator":"@fast2sms","twitter_site":"@fast2sms","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#article","isPartOf":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/"},"author":{"@id":"https:\/\/www.fast2sms.com\/#organization"},"headline":"PHP OTP verification on cPanel or shared hosting (Fast2SMS OTP widget)","datePublished":"2026-11-18T19:58:54+00:00","dateModified":"2026-11-18T20:34:46+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/"},"wordCount":1432,"publisher":{"@id":"https:\/\/www.fast2sms.com\/#organization"},"image":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp","articleSection":["API","OTP"],"inLanguage":"en-IN"},{"@type":"WebPage","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/","url":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/","name":"PHP OTP Verification on cPanel Hosting | Fast2SMS","isPartOf":{"@id":"https:\/\/www.fast2sms.com\/help\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#primaryimage"},"image":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp","datePublished":"2026-11-18T19:58:54+00:00","dateModified":"2026-11-18T20:34:46+00:00","description":"Add PHP OTP verification to any cPanel or shared hosting site with one file and two lines of HTML. SMS and WhatsApp OTP with Fast2SMS Smart OTP.","breadcrumb":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#breadcrumb"},"inLanguage":"en-IN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/"]}]},{"@type":"ImageObject","inLanguage":"en-IN","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#primaryimage","url":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp","contentUrl":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-add-sms-filled-hd-11-scaled.webp","width":2560,"height":1600,"caption":"Add OTP Template window on the SMS Channel tab with entity, sender and DLT template chosen and Variable 1 selected"},{"@type":"BreadcrumbList","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-php-hosting-fast2sms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fast2sms.com\/help\/"},{"@type":"ListItem","position":2,"name":"API","item":"https:\/\/www.fast2sms.com\/help\/api\/"},{"@type":"ListItem","position":3,"name":"PHP OTP verification on cPanel or shared hosting (Fast2SMS OTP widget)"}]},{"@type":"WebSite","@id":"https:\/\/www.fast2sms.com\/help\/#website","url":"https:\/\/www.fast2sms.com\/help\/","name":"Fast2SMS","description":"Help","publisher":{"@id":"https:\/\/www.fast2sms.com\/#organization"},"inLanguage":"en-IN"},{"@type":"Organization","@id":"https:\/\/www.fast2sms.com\/#organization","name":"Fast2SMS","url":"https:\/\/www.fast2sms.com\/","logo":{"@type":"ImageObject","@id":"https:\/\/www.fast2sms.com\/#logo","url":"https:\/\/www.fast2sms.com\/Fast2SMS.png","contentUrl":"https:\/\/www.fast2sms.com\/Fast2SMS.png","caption":"Fast2SMS"},"image":{"@id":"https:\/\/www.fast2sms.com\/#logo"},"email":"support@fast2sms.com","telephone":"+91-6262778822","sameAs":["https:\/\/www.facebook.com\/Fast2SMS","https:\/\/www.instagram.com\/fast2sms","https:\/\/x.com\/fast2sms","https:\/\/www.youtube.com\/Fast2SMSofficial","https:\/\/www.linkedin.com\/company\/fast2sms"]}]}},"_links":{"self":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts\/19671","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/comments?post=19671"}],"version-history":[{"count":1,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts\/19671\/revisions"}],"predecessor-version":[{"id":20042,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts\/19671\/revisions\/20042"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/media\/19664"}],"wp:attachment":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/media?parent=19671"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/categories?post=19671"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/tags?post=19671"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}