Mar 1, 2014 01:35 PM
(This post was last modified: Mar 1, 2014 04:29 PM by DerekM.)
(Mar 1, 2014 01:27 PM)badbrains Wrote: if you only need to parse a url, use parse_url.
PHP Code
<?php
$u = parse_url('https://hackforums.net');
var_dump($u);
Good example for urls Wolf.
I know several other more efficient ways to get text "between 2 chars", like Orgy and others have mentioned above but
here's a PHP beginners example. Much longer than other methods but I'm posting it just for OP learning purposes.
PHP Code
<?php
$content = '<html><title>Hello World</title></html>';
$search = '<title>';
$start = strpos($content, $search) + strlen($search);
$stop = strpos($content, '</title>', $start);
$length = ($stop - $start);
$result = substr($content, $start, $length);
echo $result;
?>
| Cheap Custom Coding | 15+ Years | Linux or Windows | C, C++, C#, PERL, PHP, VB | PM Me For Quotes |