pixel
pixel

Reputation: 5298

PHP Equivalent to Perl's URI::URL

I'm in the process of rewriting a Perl-based web crawler I wrote nearly 8 years ago in PHP. I used the quite handy URI::URL module in perl to do things like:

$sourceUrl = '/blah.html';
$baseHost = 'http://www.example.com';
my $url = URI::URL->new($sourceUrl, $baseHost);
return $url->abs;

returns: 'http://www.example.com/blah.html'

the parse_url function in PHP is quite handy, but is there something more robust? Specifically something that will give the above functionality?

Upvotes: 1

Views: 433

Answers (3)

Tony Miller
Tony Miller

Reputation: 9159

I did a bit of searching on the PEAR archive, and my first-guess approximation of URI::URL is Net_URL2. Maybe you want to give that a shot?

Upvotes: 0

ceejayoz
ceejayoz

Reputation: 180023

print $baseHost . $sourceURL;

Am I missing something? Your way seems needlessly overcomplicated.

Upvotes: 0

n3rd
n3rd

Reputation: 6089

Maybe Zend_Uri is what you are looking for?

Upvotes: 1

Related Questions