gdfhghjdfghgfhf Posted July 27, 2012 Share Posted July 27, 2012 I am displaying an external page on my website with file_get_contents() so i have no control over the text. But i need to move a string to a different location in the page. I have tried with preg_replace but it's not working. I think it's because the distance between the wildcard delimiter is too long. After moving the string, i also need to add <img> tags around it My page looks like this : (lots of html code here) <input type="hidden" name="product" value="20842421" /> (lots of html code here) <div class="articleSize"> (lots of html code here) <input type="hidden" name="product" value="20842422" /> (lots of html code here) <div class="articleSize"> (lots of html code here) The result i am expecting would be : (lots of html code here) <input type="hidden" name="product" value="20842421" /> (lots of html code here) <img src="20842421.gif"> <div class="articleSize"> (lots of html code here) <input type="hidden" name="product" value="20842422" /> (lots of html code here) <img src="20842422.gif"> <div class="articleSize"> (lots of html code here) I have over 60 different different matches to move on this page Any help would be appreciated Quote Link to comment https://forums.phpfreaks.com/topic/266316-move-a-string-to-a-different-location/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.