Reputation: 5801
i have this
http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNFyHi2aIJIV7kAlui1Sd_MQGosiBA&url=http://ksa.daralhayat.com/ksaarticle/192445
i want to get the value of url= only
Upvotes: 0
Views: 509
Reputation: 5499
For completeness the you can preg_match
with that:
/^.*url\=(.*)$/
But you should prefer the parse_url()
method that is really faster than a RegEx.
Upvotes: 0
Reputation: 70540
$url = html_entity_decode($url);
$parts = parse_url($url);
parse_str($parts['query'],$params);
echo $params['url'];
Upvotes: 7