PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Nov 19, 2019 4:26 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Wed Mar 14, 2012 8:42 am 
Offline
Forum Contributor
User avatar

Joined: Sun Apr 18, 2004 4:01 pm
Posts: 445
hi all

can somebody please help me find regex that gets link name of a URL

I need to get only link name

I've tried these but it doesn't return nothing

Syntax: [ Download ] [ Hide ]
<?php
$fileContent = file_get_contents("http://www.example.com");
$href = "http://www.this-is-my-url.com/and/my/pages/";
$pattern = "/href=\"$href\"/>(.*)(<)/i";
preg_match_all($patern, $fileContent, $match);

print_r($match);

?>
 


Top
 Profile  
 
PostPosted: Wed Mar 14, 2012 10:15 am 
Offline
Forum Newbie

Joined: Fri Jan 06, 2012 2:43 am
Posts: 9


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group