I am copying over some HTML tags, echo'ing them into a PHP file
I run into problems because some of the image HTML tags have quotes, or the double slashes in a url and that causes PHP to mess up. Is there a way to be able to read these in?
For example:
file1 has contents:
my command is:
I think it's also possible to get http tags in a double quote as well, which throws off my echo command as well. This is a shell scripting and PHP problem.
file1 has contents (Difference is the double quotes around url instead of single quotes):
my command is:
Any ideas?
Maybe one way would be to use something different than cat and only pull out the image.gif url. Problem is I don't know how to pull that url only out of the tag. Grep will pull the whole line as well. Sed I don't know how to use.
I run into problems because some of the image HTML tags have quotes, or the double slashes in a url and that causes PHP to mess up. Is there a way to be able to read these in?
For example:
file1 has contents:
Code:
<a href><img src='http://example.com/image.gif'></a>"
my command is:
Code:
echo "`grep \"href\" file1`">> file.php
I think it's also possible to get http tags in a double quote as well, which throws off my echo command as well. This is a shell scripting and PHP problem.
file1 has contents (Difference is the double quotes around url instead of single quotes):
Code:
<a href><img src="http://example.com/image.gif"></a>"
my command is:
Code:
echo "`grep \"href\" file1`">> file.php
Any ideas?
Maybe one way would be to use something different than cat and only pull out the image.gif url. Problem is I don't know how to pull that url only out of the tag. Grep will pull the whole line as well. Sed I don't know how to use.
Last edited: