According to following code if $host_name
is something like example.com
PHP returns a notice: Message: Undefined index: host
but on full URLs like http://example.com
PHP returns example.com
. I tried if statements with FALSE and NULL but didn't work.
$host_name = $this->input->post('host_name');
$parse = parse_url($host_name);
$parse_url = $parse['host'];
How can I modify the script to accept example.com and return it?