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 255 views
1 answer 155 views
1 answer 146 views
1 answer 152 views
1 answer 300 views
1 answer 185 views
...