Jump to content

finding files from html code in string


ukweb

Recommended Posts

hi

 

I'm making a newsletter system for a client which allows them to upload a template file. The template file is a HTML file, and so far I've made my code accept or reject code based on finding html tags as defined in an array.

 

The next stage is for it to find files which are required in the template and ask for them. For example I want it to find all img tags and from there store the filenames for those images in an array so the system can ask for them later.

 

Working example:

<img src="/img/01.jpg" width="280" height="75" alt="Image 1" />
<img src="/img/02.jpg" width="280" height="75" alt="Image 2" />

 

I want my system to find the img tags and then get the filenames and populate an array with them.

 

Any ideas? Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/192244-finding-files-from-html-code-in-string/
Share on other sites

Not sure how I would go about doing this, but doing some sort of string search is where I'd start.

Perhaps this may help you in this endeavor: http://www.tizag.com/phpT/php-string-strpos.php

I'd be interested in how to do this myself now, but haven't the time to play around with it at the moment  :confused: hopefully this bumps the thread for someone with a better idea for you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.