I have problems in converting some perl scripting to php (regular expressions).
Does anybody know what the equivalent in php is for the following perl string:
$domain = $ENV{'HTTP_HOST'};
Once I got $domain I would like to compare it with a value in a mysql database but I need a regular expression for that. The database value is stored in the following format:
domain.extension
The HTTP_POST however sends something like:
http://www.domain.extension/directory/1.html
I'm aware of the fact that www. can be any cname, but let me keep it simple so there are only 2 possibilities: http://domain.extension and http://www.domain.extension.
The expression needs to remove http:// and (optionally) www.
Now we have domain.extension/directory/1.html
From here it would be great if everything behind domain.extenstion would be stored in a new variable called 'temporarily' so finally we have 2 variables:
- domain.extension (for comparing in mysql)
- temporarily (i.e. /directory/1.html)
I really hope someone can help me with this.
Kind regards and thanks in advance,
Gijsbert Rochat
The Netherlands