| @@ -993,18 +993,10 @@ | ||
| 993 | 993 | wp_safe_redirect(esc_url(admin_url('admin.php?page=mxchat-prompts'))); |
| 994 | 994 | exit; |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | - // Fetch URL — use browser-like headers so servers with bot protection don't block us | |
| 998 | - $response = wp_remote_get($submitted_url, array( | |
| 999 | - 'timeout' => 30, | |
| 1000 | - 'sslverify' => false, | |
| 1001 | - 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', | |
| 1002 | - 'headers' => array( | |
| 1003 | - 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | |
| 1004 | - 'Accept-Language' => 'en-US,en;q=0.9', | |
| 1005 | - ), | |
| 1006 | - )); | |
| 997 | + // Fetch URL | |
| 998 | + $response = wp_remote_get($submitted_url, array('timeout' => 30)); | |
| 1007 | 999 | |
| 1008 | 1000 | if (is_wp_error($response) || wp_remote_retrieve_response_code($response) !== 200) { |
| 1009 | 1001 | $error_message = is_wp_error($response) ? $response->get_error_message() : 'HTTP Status: ' . wp_remote_retrieve_response_code($response); |
| 1010 | 1002 | set_transient('mxchat_admin_notice_error', |
| @@ -2838,12 +2830,11 @@ | ||
| 2838 | 2830 | foreach ($primary_indexes as $path => $source) { |
| 2839 | 2831 | $url = trailingslashit($site_url) . $path; |
| 2840 | 2832 | |
| 2841 | 2833 | $response = wp_remote_head($url, array( |
| 2842 | - 'timeout' => 10, | |
| 2834 | + 'timeout' => 3, // Short timeout | |
| 2843 | 2835 | 'sslverify' => false, |
| 2844 | - 'redirection' => 1, | |
| 2845 | - 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', | |
| 2836 | + 'redirection' => 1 | |
| 2846 | 2837 | )); |
| 2847 | 2838 | |
| 2848 | 2839 | if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) === 200) { |
| 2849 | 2840 | // Found a sitemap index - parse it to get sub-sitemaps |
| @@ -2901,15 +2892,10 @@ | ||
| 2901 | 2892 | private function parse_sitemap_index($url) { |
| 2902 | 2893 | $sub_sitemaps = array(); |
| 2903 | 2894 | |
| 2904 | 2895 | $response = wp_remote_get($url, array( |
| 2905 | - 'timeout' => 30, | |
| 2906 | - 'sslverify' => false, | |
| 2907 | - 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', | |
| 2908 | - 'headers' => array( | |
| 2909 | - 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | |
| 2910 | - 'Accept-Language' => 'en-US,en;q=0.9', | |
| 2911 | - ), | |
| 2896 | + 'timeout' => 5, | |
| 2897 | + 'sslverify' => false | |
| 2912 | 2898 | )); |
| 2913 | 2899 | |
| 2914 | 2900 | if (is_wp_error($response)) { |
| 2915 | 2901 | return $sub_sitemaps; |
| @@ -2960,15 +2946,10 @@ | ||
| 2960 | 2946 | * Get URL count from a sitemap |
| 2961 | 2947 | */ |
| 2962 | 2948 | private function get_sitemap_url_count($url) { |
| 2963 | 2949 | $response = wp_remote_get($url, array( |
| 2964 | - 'timeout' => 30, | |
| 2965 | - 'sslverify' => false, | |
| 2966 | - 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', | |
| 2967 | - 'headers' => array( | |
| 2968 | - 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', | |
| 2969 | - 'Accept-Language' => 'en-US,en;q=0.9', | |
| 2970 | - ), | |
| 2950 | + 'timeout' => 10, | |
| 2951 | + 'sslverify' => false | |
| 2971 | 2952 | )); |
| 2972 | 2953 | |
| 2973 | 2954 | if (is_wp_error($response)) { |
| 2974 | 2955 | return 0; |
| @@ -2991,11 +2972,10 @@ | ||
| 2991 | 2972 | $sitemaps = array(); |
| 2992 | 2973 | $robots_url = trailingslashit($site_url) . 'robots.txt'; |
| 2993 | 2974 | |
| 2994 | 2975 | $response = wp_remote_get($robots_url, array( |
| 2995 | - 'timeout' => 15, | |
| 2996 | - 'sslverify' => false, | |
| 2997 | - 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', | |
| 2976 | + 'timeout' => 5, | |
| 2977 | + 'sslverify' => false | |
| 2998 | 2978 | )); |
| 2999 | 2979 | |
| 3000 | 2980 | if (is_wp_error($response)) { |
| 3001 | 2981 | return $sitemaps; |