脚本宝典收集整理的这篇文章主要介绍了如何从PHP中的字符串中提取URL?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我的目标是获取照片网址.
我能够得到以下值(分配给PHP变量):
<p><a href="http://www.flickr.COM/PEople/19725893@N00/">codewrecker</a> posted a photo:</p> <p><a href="http://www.flickr.com/photos/19725893@N00/2302759205/" tITle="Santa Monica Pier"><img src="http://farm3.static.flickr.com/2298/2302759205_4fb109f367_m.jpg" width="180" height="240" alt="Santa Monica Pier" /></a></p>
http://farm3.static.flickr.com/2298/2302759205_4fb109f367_m.jpg
万一它有帮助,这是我正在使用的代码:
<?PHP $xML = simplexml_load_file("http://api.flickr.com/services/Feeds/photos_public.gne?id=19725893@N00&lang=en-us&format=xml&tags=carousel"); foreach($xml->entry as $child) { $flickr_content = $child->content; // gets html including img url // how can I get the img url From "$flickr_content"??? } ?>
以上是脚本宝典为你收集整理的如何从PHP中的字符串中提取URL?全部内容,希望文章能够帮你解决如何从PHP中的字符串中提取URL?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。