9three Posted February 17, 2009 Share Posted February 17, 2009 I'm grabbing information from a site. I only need two things from there. 1. the URL so the image can show up 2. the image path heres what I got so far <?php $gold = file_get_contents('http://www.site.com/'); preg_match('~http://www.site.com/~is', $gold, $url); preg_match('~<span id = "XAU_B">(.+?)</span>~is', $gold, $goldMatch); for ($i = 0; $i < 1; $i++) echo $url[$i].$goldMatch[$i]; ?> The output and problem: http://www.site.com/<span id = "XAU_B"><img src="tbdfc/freeprice.aspx?id=25632d3e-b712-9638-8029-8ffc3b112b3b&nolog=true" id="i_XAU_B"></span> Basically what I'm trying to do is <span id = "XAU_B"><img src="http://www.site.com/tbdfc/freeprice.aspx?id=25632d3e-b712-9638-8029-8ffc3b112b3b&nolog=true" id="i_XAU_B"></span> Link to comment https://forums.phpfreaks.com/topic/145527-solved-preg-match-url-and-image/ Share on other sites More sharing options...
9three Posted February 17, 2009 Author Share Posted February 17, 2009 fixed it. Link to comment https://forums.phpfreaks.com/topic/145527-solved-preg-match-url-and-image/#findComment-764030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.