RE: [PHP] Simple String Handling
| From: | Cynic | Date: | Fri, 22 Dec 2000 23:32:04 +0000 |
| Subject: | RE: [PHP] Simple String Handling | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-31632@lists.php.net to get a copy of this message | ||
Sure not.
parse_url( 'http://www.xxx.domain.tld/path/to/somewhere.php?var=val&another=something'
) ;
produces
array(4) {
["scheme"]=>
string(4) "http"
["host"]=>
string(18) "www.xxx.domain.tld"
["path"]=>
string(22) "/path/to/somewhere.php"
["query"]=>
string(25) "var=val&another=something"
}
At 21:15 22.12. 2000, Gerry Chu wrote the following:
--------------------------------------------------------------
>I'm new at this, but wouldn't the easiest way be to use parse_url()?
>
>Gerry
>
>> -----Original Message-----
>> From: o.cook@etoncollege.org.uk [mailto:o.cook@etoncollege.org.uk]
>> Sent: Friday, December 22, 2000 6:46 AM
>> To: php-general@lists.php.net
>> Subject: [PHP] Simple String Handling
>>
>>
>> I am trying to do some handling on a string which contains a
>> domain name. I
>> can successfully get the TLD but am having less success getting the domain
>> name.
>>
>> My code is:
>>
>> <?
>> $tld = strstr ($input, '.');
>> print $tld;
>> ?>
>>
>> Given:
>> $input="something.co.uk" ---> $tld=".co.uk" OK
>> $input="something.com" -----> $tld=".com" OK
>>
>> I would also like to get the domain name such that:
>>
>> $input="something.co.uk" ---> $domain="something"
>> $input="something.com" -----> $domain="something"
>>
>> Would someone be kind enough to point me in the correct direction?
>>
>> Thank you,
>>
>> Ollie
>>
>> ---
>> Do radioactive cats have 18 half-lives?
>> ñV]Ç GSi.×Î\·á
>> http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x53D29567
>> ---
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>> For additional commands, e-mail: php-general-help@lists.php.net
>> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
>For additional commands, e-mail: php-general-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz