{"id":450,"date":"2011-10-23T14:06:26","date_gmt":"2011-10-23T21:06:26","guid":{"rendered":"http:\/\/virendrachandak.wordpress.com\/?p=450"},"modified":"2016-03-20T12:22:49","modified_gmt":"2016-03-20T19:22:49","slug":"getting-real-client-ip-address-in-php-2","status":"publish","type":"post","link":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/","title":{"rendered":"Getting real client IP address in PHP"},"content":{"rendered":"<p>Many times we need the visitor&#8217;s ipaddress for validation, security, spam prevention, etc. Getting the Visitor&#8217;s ipaddress is very easy in PHP.<\/p>\n<p>The simplest way to get the visitor&#8217;s\/client&#8217;s ipaddress is using the <code>$_SERVER['REMOTE_ADDR']<\/code> or <code>$_SERVER['REMOTE_HOST']<\/code> variables. The variable in the <code>$_SERVER<\/code> array are created by the web server (like apache) and we can use them in PHP.<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ Get the client ip address\r\n$ipaddress = $_SERVER&#x5B;'REMOTE_ADDR']\r\n<\/pre>\n<p><!--more--><br \/>\nHowever, sometimes this does not returns the correct ipaddress of the visitor. This can be occur due to reasons like the user is behind a proxy, your apache server is behind a reverse proxy (e.g. varnish), etc. So we can use some other server variables to get the ipaddress. <\/p>\n<p>You can use any of the following 2 functions. Both the functions are equivalent with the difference only in how and from where the values are retrieved. The first one <code>getenv()<\/code> is used to get the values from PHP&#8217;s environment variables and the second one <code>$_SERVER<\/code> is used to get the values from the web server (e.g. apache).<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ Function to get the client ip address\r\nfunction get_client_ip_env() {\r\n\t$ipaddress = '';\r\n\tif (getenv('HTTP_CLIENT_IP'))\r\n\t\t$ipaddress = getenv('HTTP_CLIENT_IP');\r\n\telse if(getenv('HTTP_X_FORWARDED_FOR'))\r\n\t\t$ipaddress = getenv('HTTP_X_FORWARDED_FOR');\r\n\telse if(getenv('HTTP_X_FORWARDED'))\r\n\t\t$ipaddress = getenv('HTTP_X_FORWARDED');\r\n\telse if(getenv('HTTP_FORWARDED_FOR'))\r\n\t\t$ipaddress = getenv('HTTP_FORWARDED_FOR');\r\n\telse if(getenv('HTTP_FORWARDED'))\r\n\t\t$ipaddress = getenv('HTTP_FORWARDED');\r\n\telse if(getenv('REMOTE_ADDR'))\r\n\t\t$ipaddress = getenv('REMOTE_ADDR');\r\n\telse\r\n\t\t$ipaddress = 'UNKNOWN';\r\n\r\n\treturn $ipaddress;\r\n}\r\n<\/pre>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n\/\/ Function to get the client ip address\r\nfunction get_client_ip_server() {\r\n\t$ipaddress = '';\r\n\tif ($_SERVER&#x5B;'HTTP_CLIENT_IP'])\r\n\t\t$ipaddress = $_SERVER&#x5B;'HTTP_CLIENT_IP'];\r\n\telse if($_SERVER&#x5B;'HTTP_X_FORWARDED_FOR'])\r\n\t\t$ipaddress = $_SERVER&#x5B;'HTTP_X_FORWARDED_FOR'];\r\n\telse if($_SERVER&#x5B;'HTTP_X_FORWARDED'])\r\n\t\t$ipaddress = $_SERVER&#x5B;'HTTP_X_FORWARDED'];\r\n\telse if($_SERVER&#x5B;'HTTP_FORWARDED_FOR'])\r\n\t\t$ipaddress = $_SERVER&#x5B;'HTTP_FORWARDED_FOR'];\r\n\telse if($_SERVER&#x5B;'HTTP_FORWARDED'])\r\n\t\t$ipaddress = $_SERVER&#x5B;'HTTP_FORWARDED'];\r\n\telse if($_SERVER&#x5B;'REMOTE_ADDR'])\r\n\t\t$ipaddress = $_SERVER&#x5B;'REMOTE_ADDR'];\r\n\telse\r\n\t\t$ipaddress = 'UNKNOWN';\r\n\r\n\treturn $ipaddress;\r\n}\r\n<\/pre>\n<p><strong><a title=\"getenv\" href=\"http:\/\/www.php.net\/manual\/en\/function.getenv.php\" target=\"_blank\" rel=\"external nofollow\">getenv()<\/a><\/strong> is used to get the value of an environment variable in PHP<br \/>\n<strong><a title=\"$_SERVER\" href=\"http:\/\/www.php.net\/manual\/en\/reserved.variables.server.php\" target=\"_blank\" rel=\"external nofollow\">$_SERVER<\/a><\/strong> is an array contains server variables created by the web server.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Note<\/span><\/strong>: <strong>HTTP_X_FORWARDED_FOR<\/strong> sometimes returns internal or local IP address, which is not usually useful. Also, it would return a comma separated list if it was forwarded from multiple ipaddresses.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Note<\/span><\/strong>: This would work only on live site, because on your local host your ip would be one of the internal ip addresses, like 127.0.0.1<\/p>\n<div><a id=\"demo_link\" href=\"http:\/\/www.virendrachandak.com\/demos\/getting-real-client-ip-address-in-php.php\" data-title=\"View Demo\"><i class=\"icon fa fa-camera-retro\"><\/i> View Demo<\/a><br \/>\n<a id=\"source_link\" href=\"http:\/\/www.virendrachandak.com\/demos\/getting-real-client-ip-address-in-php.zip\" data-title=\"Download Source Code\"><i class=\"icon fa fa-download\"><\/i>  Download Source Code<\/a><\/div>\n<p><strong><span style=\"text-decoration: underline;\">References<\/span><\/strong>:<\/p>\n<ul>\n<li><a title=\"Getting real IP address in PHP\" href=\"http:\/\/roshanbh.com.np\/2007\/12\/getting-real-ip-address-in-php.html\" target=\"_blank\" rel=\"external nofollow\">http:\/\/roshanbh.com.np\/2007\/12\/getting-real-ip-address-in-php.html<\/a><\/li>\n<li><a title=\"PHP - get client ip address\" href=\"http:\/\/admincmd.blogspot.com\/2007\/08\/php-get-client-ip-address.html\" target=\"_blank\" rel=\"external nofollow\">http:\/\/admincmd.blogspot.com\/2007\/08\/php-get-client-ip-address.html<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Many times we need the visitor&#8217;s ipaddress for validation, security, spam prevention, etc. Getting the Visitor&#8217;s ipaddress is very easy in PHP. The simplest way to get the visitor&#8217;s\/client&#8217;s ipaddress is using the $_SERVER[&#8216;REMOTE_ADDR&#8217;] or $_SERVER[&#8216;REMOTE_HOST&#8217;] variables. The variable in the $_SERVER array are created by the web server (like apache) and we can use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3,143,8],"tags":[42,124,83],"class_list":["post-450","post","type-post","status-publish","format-standard","hentry","category-functionality","category-php","category-web-development","tag-ip-address","tag-snippets","tag-web-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Getting real client IP address in PHP - Virendra&#039;s TechTalk<\/title>\n<meta name=\"description\" content=\"Many times we need the visitor&#039;s ipaddress for validation, security, spam prevention, etc. Getting the Visitor&#039;s ipaddress is very easy in PHP. The\" \/>\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.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting real client IP address in PHP - Virendra&#039;s TechTalk\" \/>\n<meta property=\"og:description\" content=\"Many times we need the visitor&#039;s ipaddress for validation, security, spam prevention, etc. Getting the Visitor&#039;s ipaddress is very easy in PHP. The\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Virendra&#039;s TechTalk\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/virendrachandak\" \/>\n<meta property=\"article:published_time\" content=\"2011-10-23T21:06:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-20T19:22:49+00:00\" \/>\n<meta name=\"author\" content=\"Virendra Chandak\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:site\" content=\"@virendrachandak\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virendra Chandak\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/\"},\"author\":{\"name\":\"Virendra Chandak\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"headline\":\"Getting real client IP address in PHP\",\"datePublished\":\"2011-10-23T21:06:26+00:00\",\"dateModified\":\"2016-03-20T19:22:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/\"},\"wordCount\":456,\"commentCount\":46,\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"keywords\":[\"IP address\",\"snippets\",\"Web server\"],\"articleSection\":[\"Functionality\",\"PHP\",\"Web Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/\",\"name\":\"Getting real client IP address in PHP - Virendra&#039;s TechTalk\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\"},\"datePublished\":\"2011-10-23T21:06:26+00:00\",\"dateModified\":\"2016-03-20T19:22:49+00:00\",\"description\":\"Many times we need the visitor's ipaddress for validation, security, spam prevention, etc. Getting the Visitor's ipaddress is very easy in PHP. The\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/getting-real-client-ip-address-in-php-2\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"TechTalk\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Functionality\",\"item\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/category\\\/functionality\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Getting real client IP address in PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#website\",\"url\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/\",\"name\":\"Virendra's TechTalk\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/63f7ffa1ea125e32af9618d188349e17\",\"name\":\"Virendra Chandak\",\"logo\":{\"@id\":\"https:\\\/\\\/www.virendrachandak.com\\\/techtalk\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.virendrachandak.com\",\"https:\\\/\\\/www.facebook.com\\\/virendrachandak\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/virendrachandak\\\/\",\"https:\\\/\\\/x.com\\\/virendrachandak\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Getting real client IP address in PHP - Virendra&#039;s TechTalk","description":"Many times we need the visitor's ipaddress for validation, security, spam prevention, etc. Getting the Visitor's ipaddress is very easy in PHP. The","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.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/","og_locale":"en_US","og_type":"article","og_title":"Getting real client IP address in PHP - Virendra&#039;s TechTalk","og_description":"Many times we need the visitor's ipaddress for validation, security, spam prevention, etc. Getting the Visitor's ipaddress is very easy in PHP. The","og_url":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/","og_site_name":"Virendra&#039;s TechTalk","article_publisher":"https:\/\/www.facebook.com\/virendrachandak","article_author":"https:\/\/www.facebook.com\/virendrachandak","article_published_time":"2011-10-23T21:06:26+00:00","article_modified_time":"2016-03-20T19:22:49+00:00","author":"Virendra Chandak","twitter_card":"summary_large_image","twitter_creator":"@virendrachandak","twitter_site":"@virendrachandak","twitter_misc":{"Written by":"Virendra Chandak","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/#article","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/"},"author":{"name":"Virendra Chandak","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"headline":"Getting real client IP address in PHP","datePublished":"2011-10-23T21:06:26+00:00","dateModified":"2016-03-20T19:22:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/"},"wordCount":456,"commentCount":46,"publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"keywords":["IP address","snippets","Web server"],"articleSection":["Functionality","PHP","Web Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/","url":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/","name":"Getting real client IP address in PHP - Virendra&#039;s TechTalk","isPartOf":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website"},"datePublished":"2011-10-23T21:06:26+00:00","dateModified":"2016-03-20T19:22:49+00:00","description":"Many times we need the visitor's ipaddress for validation, security, spam prevention, etc. Getting the Visitor's ipaddress is very easy in PHP. The","breadcrumb":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.virendrachandak.com\/techtalk\/getting-real-client-ip-address-in-php-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"TechTalk","item":"https:\/\/www.virendrachandak.com\/techtalk\/"},{"@type":"ListItem","position":2,"name":"Functionality","item":"https:\/\/www.virendrachandak.com\/techtalk\/category\/functionality\/"},{"@type":"ListItem","position":3,"name":"Getting real client IP address in PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.virendrachandak.com\/techtalk\/#website","url":"https:\/\/www.virendrachandak.com\/techtalk\/","name":"Virendra's TechTalk","description":"","publisher":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.virendrachandak.com\/techtalk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/63f7ffa1ea125e32af9618d188349e17","name":"Virendra Chandak","logo":{"@id":"https:\/\/www.virendrachandak.com\/techtalk\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.virendrachandak.com","https:\/\/www.facebook.com\/virendrachandak","https:\/\/www.linkedin.com\/in\/virendrachandak\/","https:\/\/x.com\/virendrachandak"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2vTtQ-7g","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":802,"url":"https:\/\/www.virendrachandak.com\/techtalk\/voting-functionality-in-a-website\/","url_meta":{"origin":450,"position":0},"title":"Voting Functionality in a website","author":"Virendra Chandak","date":"April 10, 2011","format":false,"excerpt":"In this post I will give the step by step explanation of how we can add Voting Functionality to a website. At the end of this article we will have a working sample voting application. The source code for the sample voting application can be downloaded from here. We will\u2026","rel":"","context":"In &quot;Functionality&quot;","block_context":{"text":"Functionality","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/functionality\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virendrachandak.com\/techtalk\/wp-content\/uploads\/2011\/10\/initial.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":255,"url":"https:\/\/www.virendrachandak.com\/techtalk\/more-htaccess-tips\/","url_meta":{"origin":450,"position":1},"title":"more .htaccess tips","author":"Virendra Chandak","date":"October 16, 2011","format":false,"excerpt":"In my previous post .htaccess tips I had started with what is .htaccess file and some things that can be done using it. In this post I'll cover more about .htaccess files. Topics Covered: Directory index file Redirection Preferred domain (www or non-www) Redirect old site to new site Redirect\u2026","rel":"","context":"In &quot;Server Configuration&quot;","block_context":{"text":"Server Configuration","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/server-configuration\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":572,"url":"https:\/\/www.virendrachandak.com\/techtalk\/migrating-servers-using-dns-ttl-for-minimum-downtime\/","url_meta":{"origin":450,"position":2},"title":"Migrating servers using DNS TTL for minimum downtime","author":"Virendra Chandak","date":"December 17, 2011","format":false,"excerpt":"You have your site running on an old hardware and want to migrate it to a new upgraded hardware which would result in change of the ipaddress of your site and in turn imply downtime for your site. You want to minimize the downtime due to the change in ipaddress.\u2026","rel":"","context":"In &quot;Optimization Tips&quot;","block_context":{"text":"Optimization Tips","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/optimization-tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":699,"url":"https:\/\/www.virendrachandak.com\/techtalk\/get-search-query-string-from-search-engines-using-php\/","url_meta":{"origin":450,"position":3},"title":"Get search query string from search engines using PHP","author":"Virendra Chandak","date":"February 4, 2012","format":false,"excerpt":"I have often come across situations when I would like to implement some functionality based on what the user searched for in a search engine like Google, Bing etc. The search query string is normally passed as GET variables 'q' or 'query'. The function below will return the search query\u2026","rel":"","context":"In &quot;PHP&quot;","block_context":{"text":"PHP","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/php\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":803,"url":"https:\/\/www.virendrachandak.com\/techtalk\/parts-of-url\/","url_meta":{"origin":450,"position":4},"title":"Parts of URL","author":"Virendra Chandak","date":"May 26, 2012","format":false,"excerpt":"We see so many URLs everyday, but do we know what are the parts of an URL, what does each part means? In this post I will discuss the various parts of the URL. An URL may consists of as many as 6 parts. The different parts of the URL\u2026","rel":"","context":"In &quot;Glossary\/Definitions&quot;","block_context":{"text":"Glossary\/Definitions","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/glossarydefinitions\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1090,"url":"https:\/\/www.virendrachandak.com\/techtalk\/how-to-hide-apache-information-with-servertokens-and-serversignature-directives\/","url_meta":{"origin":450,"position":5},"title":"How to hide apache information with ServerTokens and ServerSignature directives","author":"Virendra Chandak","date":"February 19, 2013","format":false,"excerpt":"In default Apache configuration, the server sends HTTP Header with the information of Apache version, modules, Operating System, etc of the Server. The HTTP response header \u201cServer\u201d displays all these details of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Apache,\u2026","rel":"","context":"In &quot;Server Configuration&quot;","block_context":{"text":"Server Configuration","link":"https:\/\/www.virendrachandak.com\/techtalk\/category\/server-configuration\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/comments?post=450"}],"version-history":[{"count":0,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/posts\/450\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virendrachandak.com\/techtalk\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}