Preg Match

Trying to match image location from the following:

<a id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage" href="http://viewmorepics.myspace.com/index.cfm?fuseaction=user.viewAlbums&amp;friendID=142797907"><img border="0" alt="" src="http://a672.ac-images.myspacecdn.com/images01/81/m_06ef16901ee2ddeaf14c1f5edbf61927.jpg" />

Using the following:

[code]preg_match("/.*?/is",$buff,$match);

		$string_ahref = $match[0];
		//echo "string = ".$string_ahref;
		

		$substr = substr($string_ahref,0,350);
	
		$trimed = strip_tags($substr,"<img>");
		$trimed = trim($trimed);[/code]

It keeps returning more than the img src it returns:

r="0" alt="" src="http://a109.ac-images.myspacecdn.com/images01/78/m_3806f8eb1a289dd0a5d713a14

When it should only return:

http://a109.ac-images.myspacecdn.com/images01/78/m_3806f8eb1a289dd0a5d713a14

Any ideas?

$match[1] should contain the url, without having to use substr, strip_tags and trim.

just use $trimed = $match[1];

Sponsor our Newsletter | Privacy Policy | Terms of Service