Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php check if url exists

<?php
  
// Initialize a URL to the variable
$url = "https://www.geeksforgeeks.org";
  
// Use get_headers() function
$headers = @get_headers($url);
  
// Use condition to check the existence of URL
if($headers && strpos( $headers[0], '200')) {
    $status = "URL Exist";
}
else {
    $status = "URL Doesn't Exist";
}
  
// Display result
echo($status);
  
?>
Comment

PHP check if url parameter exists

if(isset($_GET['id']))
{
    // Do something
}
Comment

php check if a url exists

function urlExists($url=NULL)
    {
        if($url == NULL) return false;
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $data = curl_exec($ch);
        $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch); 
        if($httpcode>=200 && $httpcode<300){
            return true;
        } else {
            return false;
        }
    }
Comment

php check if parameter exists in url

print_r($_GET); // to check the parm list in url

if(isset($_GET['id']))
{
  echo $_GET['id'];
    // Do something
}
Comment

PREVIOUS NEXT
Code Example
Php :: tackle discount in php laravel blade 
Php :: laravel tinker add user 
Php :: route not defined. laravel 9 
Php :: How to get only year, month and day from timestamp in Laravel 
Php :: PHP | get client ip 
Php :: php remove empty values from array 
Php :: how to install dompdf in laravel 
Php :: laravel get last month records 
Php :: woocommerce change "Billing Details" text 
Php :: laravel blade auth user 
Php :: install php 7.4 ubuntu 
Php :: start php session 
Php :: unset session in php 
Php :: blade formatting vscode 
Php :: running a laravel app locally 
Php :: toaster message in laravel 
Php :: php session working on localhost but not on hosting server 
Php :: Woocommerce Display field value on the admin order edit page [Custom Field Display 2] 
Php :: wp enqueue style 
Php :: Invalid argument supplied for foreach() 
Php :: laravel update and insert transaction 
Php :: what is directory_separator in php 
Php :: php array length 
Php :: response()-make laravel pdf 
Php :: Array Contant PHP 
Php :: Laravel 9 Clear Cache of Route, View, Config, Event Commands 
Php :: php get text from html 
Php :: update sql php 
Php :: composer update withou memory limit 
Php :: how to change laravel port 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =