How to check whether url contains https or http in PHP

1 Answer

0 votes
$url = parse_url('https://seek4info.com/');

if ($url['scheme'] == 'https') {
   echo "https";
}
else {
    echo "http";
}

 
/*
run:

https
 
*/
 

 



answered Feb 22, 2019 by avibootz

Related questions

2 answers 248 views
1 answer 148 views
1 answer 142 views
1 answer 146 views
1 answer 296 views
1 answer 181 views
...