function is_google_ip($ip) { // updated: 2025-04-04 // Convert IP string to number if (is_string($ip)) { $bytes = explode('.', $ip); $ip = 0; foreach ($bytes as $n) { $ip <<= 8; $ip |= (int)$n; } } // Check rules switch ($ip & 0b0_11111111_11111111_11111111_11100000) { // mask: 255.255.255.224 case 0b0_00100010_00010110_01010101_00000000: // ip: 34.22.85.0 case 0b0_01000010_11111001_01000000_00000000: // ip: 66.249.64.0 case 0b0_01000010_11111001_01000000_00100000: // ip: 66.249.64.32 case 0b0_01000010_11111001_01000000_01000000: // ip: 66.249.64.64 case 0b0_01000010_11111001_01000000_01100000: // ip: 66.249.64.96 case 0b0_01000010_11111001_01000000_10000000: // ip: 66.249.64.128 case 0b0_01000010_11111001_01000000_10100000: // ip: 66.249.64.160 case 0b0_01000010_11111001_01000000_11100000: // ip: 66.249.64.224 case 0b0_01000010_11111001_01000001_00000000: // ip: 66.249.65.0 case 0b0_01000010_11111001_01000001_00100000: // ip: 66.249.65.32 case 0b0_01000010_11111001_01000001_01000000: // ip: 66.249.65.64 case 0b0_01000010_11111001_01000001_01100000: // ip: 66.249.65.96 case 0b0_01000010_11111001_01000001_10000000: // ip: 66.249.65.128 case 0b0_01000010_11111001_01000001_10100000: // ip: 66.249.65.160 case 0b0_01000010_11111001_01000001_11000000: // ip: 66.249.65.192 case 0b0_01000010_11111001_01000001_11100000: // ip: 66.249.65.224 case 0b0_01000010_11111001_01000010_00000000: // ip: 66.249.66.0 case 0b0_01000010_11111001_01000010_00100000: // ip: 66.249.66.32 case 0b0_01000010_11111001_01000010_01000000: // ip: 66.249.66.64 case 0b0_01000010_11111001_01000010_01100000: // ip: 66.249.66.96 case 0b0_01000010_11111001_01000010_10000000: // ip: 66.249.66.128 case 0b0_01000010_11111001_01000010_10100000: // ip: 66.249.66.160 case 0b0_01000010_11111001_01000010_11000000: // ip: 66.249.66.192 case 0b0_01000010_11111001_01000010_11100000: // ip: 66.249.66.224 case 0b0_01000010_11111001_01000100_00000000: // ip: 66.249.68.0 case 0b0_01000010_11111001_01000100_00100000: // ip: 66.249.68.32 case 0b0_01000010_11111001_01000100_01000000: // ip: 66.249.68.64 case 0b0_01000010_11111001_01000100_01100000: // ip: 66.249.68.96 case 0b0_01000010_11111001_01000100_10000000: // ip: 66.249.68.128 case 0b0_01000010_11111001_01000101_00000000: // ip: 66.249.69.0 case 0b0_01000010_11111001_01000101_00100000: // ip: 66.249.69.32 case 0b0_01000010_11111001_01000101_01000000: // ip: 66.249.69.64 case 0b0_01000010_11111001_01000101_01100000: // ip: 66.249.69.96 case 0b0_01000010_11111001_01000101_10000000: // ip: 66.249.69.128 case 0b0_01000010_11111001_01000101_10100000: // ip: 66.249.69.160 case 0b0_01000010_11111001_01000101_11000000: // ip: 66.249.69.192 case 0b0_01000010_11111001_01000101_11100000: // ip: 66.249.69.224 case 0b0_01000010_11111001_01000110_00000000: // ip: 66.249.70.0 case 0b0_01000010_11111001_01000110_00100000: // ip: 66.249.70.32 case 0b0_01000010_11111001_01000110_01000000: // ip: 66.249.70.64 case 0b0_01000010_11111001_01000110_01100000: // ip: 66.249.70.96 case 0b0_01000010_11111001_01000110_10000000: // ip: 66.249.70.128 case 0b0_01000010_11111001_01000110_10100000: // ip: 66.249.70.160 case 0b0_01000010_11111001_01000110_11000000: // ip: 66.249.70.192 case 0b0_01000010_11111001_01000110_11100000: // ip: 66.249.70.224 case 0b0_01000010_11111001_01000111_00000000: // ip: 66.249.71.0 case 0b0_01000010_11111001_01000111_00100000: // ip: 66.249.71.32 case 0b0_01000010_11111001_01000111_01000000: // ip: 66.249.71.64 case 0b0_01000010_11111001_01000111_01100000: // ip: 66.249.71.96 case 0b0_01000010_11111001_01000111_10000000: // ip: 66.249.71.128 case 0b0_01000010_11111001_01000111_10100000: // ip: 66.249.71.160 case 0b0_01000010_11111001_01000111_11000000: // ip: 66.249.71.192 case 0b0_01000010_11111001_01000111_11100000: // ip: 66.249.71.224 case 0b0_01000010_11111001_01001000_00000000: // ip: 66.249.72.0 case 0b0_01000010_11111001_01001000_00100000: // ip: 66.249.72.32 case 0b0_01000010_11111001_01001000_01000000: // ip: 66.249.72.64 case 0b0_01000010_11111001_01001000_01100000: // ip: 66.249.72.96 case 0b0_01000010_11111001_01001000_10000000: // ip: 66.249.72.128 case 0b0_01000010_11111001_01001000_10100000: // ip: 66.249.72.160 case 0b0_01000010_11111001_01001000_11000000: // ip: 66.249.72.192 case 0b0_01000010_11111001_01001000_11100000: // ip: 66.249.72.224 case 0b0_01000010_11111001_01001001_00000000: // ip: 66.249.73.0 case 0b0_01000010_11111001_01001001_00100000: // ip: 66.249.73.32 case 0b0_01000010_11111001_01001001_01000000: // ip: 66.249.73.64 case 0b0_01000010_11111001_01001001_01100000: // ip: 66.249.73.96 case 0b0_01000010_11111001_01001001_10000000: // ip: 66.249.73.128 case 0b0_01000010_11111001_01001001_10100000: // ip: 66.249.73.160 case 0b0_01000010_11111001_01001001_11000000: // ip: 66.249.73.192 case 0b0_01000010_11111001_01001001_11100000: // ip: 66.249.73.224 case 0b0_01000010_11111001_01001010_00000000: // ip: 66.249.74.0 case 0b0_01000010_11111001_01001010_00100000: // ip: 66.249.74.32 case 0b0_01000010_11111001_01001010_01000000: // ip: 66.249.74.64 case 0b0_01000010_11111001_01001010_01100000: // ip: 66.249.74.96 case 0b0_01000010_11111001_01001010_10000000: // ip: 66.249.74.128 case 0b0_01000010_11111001_01001010_10100000: // ip: 66.249.74.160 case 0b0_01000010_11111001_01001010_11000000: // ip: 66.249.74.192 case 0b0_01000010_11111001_01001011_00000000: // ip: 66.249.75.0 case 0b0_01000010_11111001_01001011_00100000: // ip: 66.249.75.32 case 0b0_01000010_11111001_01001011_01000000: // ip: 66.249.75.64 case 0b0_01000010_11111001_01001011_01100000: // ip: 66.249.75.96 case 0b0_01000010_11111001_01001011_10000000: // ip: 66.249.75.128 case 0b0_01000010_11111001_01001011_10100000: // ip: 66.249.75.160 case 0b0_01000010_11111001_01001011_11000000: // ip: 66.249.75.192 case 0b0_01000010_11111001_01001011_11100000: // ip: 66.249.75.224 case 0b0_01000010_11111001_01001100_00000000: // ip: 66.249.76.0 case 0b0_01000010_11111001_01001100_00100000: // ip: 66.249.76.32 case 0b0_01000010_11111001_01001100_01000000: // ip: 66.249.76.64 case 0b0_01000010_11111001_01001100_01100000: // ip: 66.249.76.96 case 0b0_01000010_11111001_01001100_10000000: // ip: 66.249.76.128 case 0b0_01000010_11111001_01001100_10100000: // ip: 66.249.76.160 case 0b0_01000010_11111001_01001100_11000000: // ip: 66.249.76.192 case 0b0_01000010_11111001_01001100_11100000: // ip: 66.249.76.224 case 0b0_01000010_11111001_01001101_00000000: // ip: 66.249.77.0 case 0b0_01000010_11111001_01001101_00100000: // ip: 66.249.77.32 case 0b0_01000010_11111001_01001101_01000000: // ip: 66.249.77.64 case 0b0_01000010_11111001_01001101_01100000: // ip: 66.249.77.96 case 0b0_01000010_11111001_01001101_10000000: // ip: 66.249.77.128 case 0b0_01000010_11111001_01001101_10100000: // ip: 66.249.77.160 case 0b0_01000010_11111001_01001101_11000000: // ip: 66.249.77.192 case 0b0_01000010_11111001_01001101_11100000: // ip: 66.249.77.224 case 0b0_01000010_11111001_01001110_00000000: // ip: 66.249.78.0 case 0b0_01000010_11111001_01001110_00100000: // ip: 66.249.78.32 case 0b0_01000010_11111001_01001111_00000000: // ip: 66.249.79.0 case 0b0_01000010_11111001_01001111_00100000: // ip: 66.249.79.32 case 0b0_01000010_11111001_01001111_01000000: // ip: 66.249.79.64 case 0b0_01000010_11111001_01001111_01100000: // ip: 66.249.79.96 case 0b0_01000010_11111001_01001111_10000000: // ip: 66.249.79.128 case 0b0_01000010_11111001_01001111_10100000: // ip: 66.249.79.160 case 0b0_01000010_11111001_01001111_11000000: // ip: 66.249.79.192 case 0b0_01000010_11111001_01001111_11100000: // ip: 66.249.79.224 case 0b0_01000010_11111001_01010111_00000000: // ip: 66.249.87.0 case 0b0_01000010_11111001_01010111_00100000: // ip: 66.249.87.32 case 0b0_01000010_11111001_01010111_01000000: // ip: 66.249.87.64 case 0b0_01000010_11111001_01010111_01100000: // ip: 66.249.87.96 case 0b0_01000010_11111001_01010111_10000000: // ip: 66.249.87.128 case 0b0_01000010_11111001_01010111_10100000: // ip: 66.249.87.160 case 0b0_01000010_11111001_01010111_11000000: // ip: 66.249.87.192 case 0b0_01000010_11111001_01010111_11100000: // ip: 66.249.87.224 case 0b0_01000010_11111001_01011001_00000000: // ip: 66.249.89.0 case 0b0_01000010_11111001_01011001_00100000: // ip: 66.249.89.32 case 0b0_01000010_11111001_01011001_01000000: // ip: 66.249.89.64 case 0b0_01000010_11111001_01011001_01100000: // ip: 66.249.89.96 case 0b0_01000010_11111001_01011001_10000000: // ip: 66.249.89.128 case 0b0_01000010_11111001_01011001_10100000: // ip: 66.249.89.160 case 0b0_01000010_11111001_01011001_11100000: // ip: 66.249.89.224 case 0b0_01000010_11111001_01011010_00000000: // ip: 66.249.90.0 case 0b0_01000010_11111001_01011010_00100000: // ip: 66.249.90.32 case 0b0_01000010_11111001_01011010_01000000: // ip: 66.249.90.64 case 0b0_01000010_11111001_01011010_01100000: // ip: 66.249.90.96 case 0b0_01000010_11111001_01011010_10000000: // ip: 66.249.90.128 case 0b0_01000010_11111001_01011010_10100000: // ip: 66.249.90.160 case 0b0_01000010_11111001_01011010_11000000: // ip: 66.249.90.192 case 0b0_01000010_11111001_01011010_11100000: // ip: 66.249.90.224 case 0b0_01000010_11111001_01011011_00000000: // ip: 66.249.91.0 case 0b0_01000010_11111001_01011011_00100000: // ip: 66.249.91.32 case 0b0_01000010_11111001_01011011_01000000: // ip: 66.249.91.64 case 0b0_01000010_11111001_01011011_01100000: // ip: 66.249.91.96 case 0b0_01000010_11111001_01011011_10000000: // ip: 66.249.91.128 case 0b0_01000010_11111001_01011011_10100000: // ip: 66.249.91.160 case 0b0_01000010_11111001_01011011_11000000: // ip: 66.249.91.192 case 0b0_01000010_11111001_01011011_11100000: // ip: 66.249.91.224 case 0b0_01000010_11111001_01011100_00000000: // ip: 66.249.92.0 case 0b0_01000010_11111001_01011100_00100000: // ip: 66.249.92.32 case 0b0_01000010_11111001_01011100_01000000: // ip: 66.249.92.64 case 0b0_01000010_11111001_01011100_01100000: // ip: 66.249.92.96 case 0b0_01000010_11111001_01011100_10000000: // ip: 66.249.92.128 case 0b0_01000010_11111001_01011100_10100000: // ip: 66.249.92.160 case 0b0_01000010_11111001_01011100_11000000: // ip: 66.249.92.192 case 0b0_01000010_11111001_01011100_11100000: // ip: 66.249.92.224 case 0b0_01001000_00001110_11000111_00000000: // ip: 72.14.199.0 case 0b0_01001000_00001110_11000111_00100000: // ip: 72.14.199.32 case 0b0_01001000_00001110_11000111_01000000: // ip: 72.14.199.64 case 0b0_01001000_00001110_11000111_01100000: // ip: 72.14.199.96 case 0b0_01001000_00001110_11000111_10000000: // ip: 72.14.199.128 case 0b0_01001000_00001110_11000111_10100000: // ip: 72.14.199.160 case 0b0_01001000_00001110_11000111_11000000: // ip: 72.14.199.192 case 0b0_01001000_00001110_11000111_11100000: // ip: 72.14.199.224 case 0b0_01001010_01111101_10010100_00000000: // ip: 74.125.148.0 case 0b0_01001010_01111101_10010100_00100000: // ip: 74.125.148.32 case 0b0_01001010_01111101_10010100_01000000: // ip: 74.125.148.64 case 0b0_01001010_01111101_10010100_01100000: // ip: 74.125.148.96 case 0b0_01001010_01111101_10010100_10000000: // ip: 74.125.148.128 case 0b0_01001010_01111101_10010100_10100000: // ip: 74.125.148.160 case 0b0_01001010_01111101_10010100_11000000: // ip: 74.125.148.192 case 0b0_01001010_01111101_10010100_11100000: // ip: 74.125.148.224 case 0b0_01001010_01111101_10010101_00000000: // ip: 74.125.149.0 case 0b0_01001010_01111101_10010101_00100000: // ip: 74.125.149.32 case 0b0_01001010_01111101_10010101_01000000: // ip: 74.125.149.64 case 0b0_01001010_01111101_10010101_01100000: // ip: 74.125.149.96 case 0b0_01001010_01111101_10010101_10000000: // ip: 74.125.149.128 case 0b0_01001010_01111101_10010101_10100000: // ip: 74.125.149.160 case 0b0_01001010_01111101_10010101_11000000: // ip: 74.125.149.192 case 0b0_01001010_01111101_10010101_11100000: // ip: 74.125.149.224 case 0b0_01001010_01111101_10010110_00000000: // ip: 74.125.150.0 case 0b0_01001010_01111101_10010110_00100000: // ip: 74.125.150.32 case 0b0_01001010_01111101_10010110_01000000: // ip: 74.125.150.64 case 0b0_01001010_01111101_10010110_01100000: // ip: 74.125.150.96 case 0b0_01001010_01111101_10010110_10000000: // ip: 74.125.150.128 case 0b0_01001010_01111101_10010111_00000000: // ip: 74.125.151.0 case 0b0_01001010_01111101_10010111_00100000: // ip: 74.125.151.32 case 0b0_01001010_01111101_10010111_01000000: // ip: 74.125.151.64 case 0b0_01001010_01111101_10010111_01100000: // ip: 74.125.151.96 case 0b0_01001010_01111101_10010111_10000000: // ip: 74.125.151.128 case 0b0_01001010_01111101_10010111_10100000: // ip: 74.125.151.160 case 0b0_01001010_01111101_10010111_11000000: // ip: 74.125.151.192 case 0b0_01001010_01111101_10010111_11100000: // ip: 74.125.151.224 case 0b0_01001010_01111101_11011000_00000000: // ip: 74.125.216.0 case 0b0_01001010_01111101_11011000_00100000: // ip: 74.125.216.32 case 0b0_01001010_01111101_11011000_01000000: // ip: 74.125.216.64 case 0b0_01001010_01111101_11011000_01100000: // ip: 74.125.216.96 case 0b0_01001010_01111101_11011000_10000000: // ip: 74.125.216.128 case 0b0_01001010_01111101_11011000_10100000: // ip: 74.125.216.160 case 0b0_01001010_01111101_11011000_11000000: // ip: 74.125.216.192 case 0b0_01001010_01111101_11011000_11100000: // ip: 74.125.216.224 case 0b0_01001010_01111101_11011001_00000000: // ip: 74.125.217.0 case 0b0_01001010_01111101_11011001_00100000: // ip: 74.125.217.32 case 0b0_01001010_01111101_11011001_01000000: // ip: 74.125.217.64 case 0b0_01001010_01111101_11011001_01100000: // ip: 74.125.217.96 case 0b0_01001010_01111101_11011001_10000000: // ip: 74.125.217.128 case 0b0_01001010_01111101_11011001_10100000: // ip: 74.125.217.160 case 0b0_01001010_01111101_11011001_11000000: // ip: 74.125.217.192 case 0b0_01001010_01111101_11011010_00000000: // ip: 74.125.218.0 case 0b0_01001010_01111101_11011010_00100000: // ip: 74.125.218.32 case 0b0_01001010_01111101_11011010_01000000: // ip: 74.125.218.64 case 0b0_01001010_01111101_11011010_01100000: // ip: 74.125.218.96 case 0b0_01001010_01111101_11011010_10000000: // ip: 74.125.218.128 case 0b0_01001010_01111101_11011010_10100000: // ip: 74.125.218.160 case 0b0_01001010_01111101_11011010_11000000: // ip: 74.125.218.192 case 0b0_01001010_01111101_11011010_11100000: // ip: 74.125.218.224 case 0b0_01001010_01111101_11011011_00000000: // ip: 74.125.219.0 case 0b0_01001010_01111101_11011011_00100000: // ip: 74.125.219.32 case 0b0_01101100_10110001_00000010_00000000: // ip: 108.177.2.0 case 0b0_01101100_10110001_00000010_00100000: // ip: 108.177.2.32 case 0b0_01101100_10110001_00000010_01000000: // ip: 108.177.2.64 case 0b0_01101100_10110001_00000010_01100000: // ip: 108.177.2.96 case 0b0_01101100_10110001_00000010_10000000: // ip: 108.177.2.128 case 0b0_01101100_10110001_00000010_10100000: // ip: 108.177.2.160 case 0b0_01101100_10110001_00000010_11000000: // ip: 108.177.2.192 case 0b0_11000000_10110010_00000101_00000000: // ip: 192.178.5.0 case 0b0_11000000_10110010_00000110_00000000: // ip: 192.178.6.0 case 0b0_11000000_10110010_00000110_00100000: // ip: 192.178.6.32 case 0b0_11000000_10110010_00000110_01000000: // ip: 192.178.6.64 case 0b0_11000000_10110010_00000110_01100000: // ip: 192.178.6.96 case 0b0_11000000_10110010_00000110_10000000: // ip: 192.178.6.128 case 0b0_11000000_10110010_00000110_10100000: // ip: 192.178.6.160 case 0b0_11000000_10110010_00000110_11000000: // ip: 192.178.6.192 case 0b0_11000000_10110010_00010001_00000000: // ip: 192.178.17.0 case 0b0_11010001_01010101_11101110_00000000: // ip: 209.85.238.0 case 0b0_11010001_01010101_11101110_00100000: // ip: 209.85.238.32 case 0b0_11010001_01010101_11101110_01000000: // ip: 209.85.238.64 case 0b0_11010001_01010101_11101110_01100000: // ip: 209.85.238.96 case 0b0_11010001_01010101_11101110_10000000: // ip: 209.85.238.128 case 0b0_11010001_01010101_11101110_10100000: // ip: 209.85.238.160 case 0b0_11010001_01010101_11101110_11000000: // ip: 209.85.238.192 case 0b0_11010001_01010101_11101110_11100000: // ip: 209.85.238.224 return true; } switch ($ip & 0b0_11111111_11111111_11111111_11110000) { // mask: 255.255.255.240 case 0b0_00100010_01000000_01010010_01000000: // ip: 34.64.82.64 case 0b0_00100010_01000001_11110010_01110000: // ip: 34.65.242.112 case 0b0_00100010_01010000_00110010_01010000: // ip: 34.80.50.80 case 0b0_00100010_01011000_11000010_00000000: // ip: 34.88.194.0 case 0b0_00100010_01011001_00001010_01010000: // ip: 34.89.10.80 case 0b0_00100010_01011001_11000110_01010000: // ip: 34.89.198.80 case 0b0_00100010_01100000_10100010_00110000: // ip: 34.96.162.48 case 0b0_00100010_01100100_10110110_01100000: // ip: 34.100.182.96 case 0b0_00100010_01100101_00110010_10010000: // ip: 34.101.50.144 case 0b0_00100010_01110110_01000010_00000000: // ip: 34.118.66.0 case 0b0_00100010_01110110_11111110_00000000: // ip: 34.118.254.0 case 0b0_00100010_01111110_10110010_01100000: // ip: 34.126.178.96 case 0b0_00100010_10010010_10010110_10010000: // ip: 34.146.150.144 case 0b0_00100010_10010011_01101110_10010000: // ip: 34.147.110.144 case 0b0_00100010_10010111_01001010_10010000: // ip: 34.151.74.144 case 0b0_00100010_10011000_00110010_01000000: // ip: 34.152.50.64 case 0b0_00100010_10011010_01110010_10010000: // ip: 34.154.114.144 case 0b0_00100010_10011011_01100010_00100000: // ip: 34.155.98.32 case 0b0_00100010_10100101_00010010_10110000: // ip: 34.165.18.176 case 0b0_00100010_10101111_10100000_01000000: // ip: 34.175.160.64 case 0b0_00100010_10110000_10000010_00010000: // ip: 34.176.130.16 case 0b0_00100011_11110111_11110011_11110000: // ip: 35.247.243.240 return true; } return false; }