Jump to content

move a string to a different location


gdfhghjdfghgfhf

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.