Placing text before every a href appearance?
up vote
1
down vote
favorite
I am currently trying to place something like this https://shortdomain.com/api?p=a-href-url-here.com before every link on my website in a specific div.
$main = get_the_content_with_formatting();
$stripped = str_replace('<a href="http://example.net/', '<a href="https://shortdomain.com/api?p=http://example.net/', $main);
The method above works, but only when the link is that URL, and with any other it obviously will just return the standard URL.
Is there a way that I can prefix my desired link to each href using JavaScript, or PHP?
Here's the selector of the contents inside of $main
#the-post > div.post-inner > div.entry > p > strong > a
javascript php jquery
add a comment |
up vote
1
down vote
favorite
I am currently trying to place something like this https://shortdomain.com/api?p=a-href-url-here.com before every link on my website in a specific div.
$main = get_the_content_with_formatting();
$stripped = str_replace('<a href="http://example.net/', '<a href="https://shortdomain.com/api?p=http://example.net/', $main);
The method above works, but only when the link is that URL, and with any other it obviously will just return the standard URL.
Is there a way that I can prefix my desired link to each href using JavaScript, or PHP?
Here's the selector of the contents inside of $main
#the-post > div.post-inner > div.entry > p > strong > a
javascript php jquery
2
you could use a DOM parser in php
– IdontDownVote
Nov 21 at 2:03
@IdontDownVote I thought about this, but it seems messy..
– John Doe
Nov 21 at 2:04
1
"Messy?" I'd submit that treating markup language like a plain text string is messy!
– miken32
Nov 21 at 2:09
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am currently trying to place something like this https://shortdomain.com/api?p=a-href-url-here.com before every link on my website in a specific div.
$main = get_the_content_with_formatting();
$stripped = str_replace('<a href="http://example.net/', '<a href="https://shortdomain.com/api?p=http://example.net/', $main);
The method above works, but only when the link is that URL, and with any other it obviously will just return the standard URL.
Is there a way that I can prefix my desired link to each href using JavaScript, or PHP?
Here's the selector of the contents inside of $main
#the-post > div.post-inner > div.entry > p > strong > a
javascript php jquery
I am currently trying to place something like this https://shortdomain.com/api?p=a-href-url-here.com before every link on my website in a specific div.
$main = get_the_content_with_formatting();
$stripped = str_replace('<a href="http://example.net/', '<a href="https://shortdomain.com/api?p=http://example.net/', $main);
The method above works, but only when the link is that URL, and with any other it obviously will just return the standard URL.
Is there a way that I can prefix my desired link to each href using JavaScript, or PHP?
Here's the selector of the contents inside of $main
#the-post > div.post-inner > div.entry > p > strong > a
javascript php jquery
javascript php jquery
edited Nov 21 at 2:22
miken32
22.6k84571
22.6k84571
asked Nov 21 at 1:52
John Doe
618
618
2
you could use a DOM parser in php
– IdontDownVote
Nov 21 at 2:03
@IdontDownVote I thought about this, but it seems messy..
– John Doe
Nov 21 at 2:04
1
"Messy?" I'd submit that treating markup language like a plain text string is messy!
– miken32
Nov 21 at 2:09
add a comment |
2
you could use a DOM parser in php
– IdontDownVote
Nov 21 at 2:03
@IdontDownVote I thought about this, but it seems messy..
– John Doe
Nov 21 at 2:04
1
"Messy?" I'd submit that treating markup language like a plain text string is messy!
– miken32
Nov 21 at 2:09
2
2
you could use a DOM parser in php
– IdontDownVote
Nov 21 at 2:03
you could use a DOM parser in php
– IdontDownVote
Nov 21 at 2:03
@IdontDownVote I thought about this, but it seems messy..
– John Doe
Nov 21 at 2:04
@IdontDownVote I thought about this, but it seems messy..
– John Doe
Nov 21 at 2:04
1
1
"Messy?" I'd submit that treating markup language like a plain text string is messy!
– miken32
Nov 21 at 2:09
"Messy?" I'd submit that treating markup language like a plain text string is messy!
– miken32
Nov 21 at 2:09
add a comment |
5 Answers
5
active
oldest
votes
up vote
3
down vote
accepted
Don't ever make the mistake of parsing HTML like text; it's not! Use a proper DOM parser to extract your values and then alter them.
<?php
$main = "<div><p>Here is some <a href='http://example.com/'>sample</a> text.</p></div>";
$dom = new DomDocument();
$dom->loadHtml($main, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
foreach ($dom->getElementsByTagName("a") as $anchor) {
$href = $anchor->getAttribute("href");
if ($href) {
$anchor->setAttribute("href", "https://shortdomain.com/api?p=" . urlencode($href));
}
}
echo $dom->saveHTML();
This will change every anchor in the document rather than just those beneath adivwith classpost-inner
– Nick
Nov 21 at 2:14
Actually I think he may only be providing part of the document content in$mainso this code is ok.
– miken32
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
add a comment |
up vote
3
down vote
This is a good task for PHP's built-in DOMDocument and DOMXpath classes. Using xpath ensures that you only change anchors inside the div that you want.
$main = '<div class="post-inner"><div class="entry"><p><strong><a href="http://example.net">link</a></strong></p></div></div>';
$doc = new DOMDocument();
$doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$anchors = $xpath->query('//div[contains(@class, "post-inner")]//a');
foreach ($anchors as $a) {
$a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue);
}
echo $doc->saveHTML();
Output:
<div class="post-inner"><div class="entry"><p><strong>
<a href="https://shortdomain.com/api?p=http://example.net">link</a>
</strong></p></div></div>
Demo on 3v4l.org
add a comment |
up vote
1
down vote
You can use the attribute selector with jquery to match all desired elements and then use the method 'attr' to change the href attribute.
$("#the-post > div.post-inner > div.entry > p > strong > a[href="http://example.net/"]")
.attr("href", "https://shortdomain.com/api?p=http://example.net/");
I didn't really test it, but it should work just fine.
add a comment |
up vote
1
down vote
If you are doing this client-side, it's pretty painless with javascript's querySelectorAll:
let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>add a comment |
up vote
0
down vote
Get rid of the dummy website then.
$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
What happens with<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".
– miken32
Nov 21 at 2:13
then remove<a
– ACD
Nov 21 at 2:25
add a comment |
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Don't ever make the mistake of parsing HTML like text; it's not! Use a proper DOM parser to extract your values and then alter them.
<?php
$main = "<div><p>Here is some <a href='http://example.com/'>sample</a> text.</p></div>";
$dom = new DomDocument();
$dom->loadHtml($main, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
foreach ($dom->getElementsByTagName("a") as $anchor) {
$href = $anchor->getAttribute("href");
if ($href) {
$anchor->setAttribute("href", "https://shortdomain.com/api?p=" . urlencode($href));
}
}
echo $dom->saveHTML();
This will change every anchor in the document rather than just those beneath adivwith classpost-inner
– Nick
Nov 21 at 2:14
Actually I think he may only be providing part of the document content in$mainso this code is ok.
– miken32
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
add a comment |
up vote
3
down vote
accepted
Don't ever make the mistake of parsing HTML like text; it's not! Use a proper DOM parser to extract your values and then alter them.
<?php
$main = "<div><p>Here is some <a href='http://example.com/'>sample</a> text.</p></div>";
$dom = new DomDocument();
$dom->loadHtml($main, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
foreach ($dom->getElementsByTagName("a") as $anchor) {
$href = $anchor->getAttribute("href");
if ($href) {
$anchor->setAttribute("href", "https://shortdomain.com/api?p=" . urlencode($href));
}
}
echo $dom->saveHTML();
This will change every anchor in the document rather than just those beneath adivwith classpost-inner
– Nick
Nov 21 at 2:14
Actually I think he may only be providing part of the document content in$mainso this code is ok.
– miken32
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Don't ever make the mistake of parsing HTML like text; it's not! Use a proper DOM parser to extract your values and then alter them.
<?php
$main = "<div><p>Here is some <a href='http://example.com/'>sample</a> text.</p></div>";
$dom = new DomDocument();
$dom->loadHtml($main, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
foreach ($dom->getElementsByTagName("a") as $anchor) {
$href = $anchor->getAttribute("href");
if ($href) {
$anchor->setAttribute("href", "https://shortdomain.com/api?p=" . urlencode($href));
}
}
echo $dom->saveHTML();
Don't ever make the mistake of parsing HTML like text; it's not! Use a proper DOM parser to extract your values and then alter them.
<?php
$main = "<div><p>Here is some <a href='http://example.com/'>sample</a> text.</p></div>";
$dom = new DomDocument();
$dom->loadHtml($main, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED);
foreach ($dom->getElementsByTagName("a") as $anchor) {
$href = $anchor->getAttribute("href");
if ($href) {
$anchor->setAttribute("href", "https://shortdomain.com/api?p=" . urlencode($href));
}
}
echo $dom->saveHTML();
answered Nov 21 at 2:07
miken32
22.6k84571
22.6k84571
This will change every anchor in the document rather than just those beneath adivwith classpost-inner
– Nick
Nov 21 at 2:14
Actually I think he may only be providing part of the document content in$mainso this code is ok.
– miken32
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
add a comment |
This will change every anchor in the document rather than just those beneath adivwith classpost-inner
– Nick
Nov 21 at 2:14
Actually I think he may only be providing part of the document content in$mainso this code is ok.
– miken32
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
This will change every anchor in the document rather than just those beneath a
div with class post-inner– Nick
Nov 21 at 2:14
This will change every anchor in the document rather than just those beneath a
div with class post-inner– Nick
Nov 21 at 2:14
Actually I think he may only be providing part of the document content in
$main so this code is ok.– miken32
Nov 21 at 2:19
Actually I think he may only be providing part of the document content in
$main so this code is ok.– miken32
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
It's hard to say from the question. I think you're probably right.
– Nick
Nov 21 at 2:19
add a comment |
up vote
3
down vote
This is a good task for PHP's built-in DOMDocument and DOMXpath classes. Using xpath ensures that you only change anchors inside the div that you want.
$main = '<div class="post-inner"><div class="entry"><p><strong><a href="http://example.net">link</a></strong></p></div></div>';
$doc = new DOMDocument();
$doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$anchors = $xpath->query('//div[contains(@class, "post-inner")]//a');
foreach ($anchors as $a) {
$a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue);
}
echo $doc->saveHTML();
Output:
<div class="post-inner"><div class="entry"><p><strong>
<a href="https://shortdomain.com/api?p=http://example.net">link</a>
</strong></p></div></div>
Demo on 3v4l.org
add a comment |
up vote
3
down vote
This is a good task for PHP's built-in DOMDocument and DOMXpath classes. Using xpath ensures that you only change anchors inside the div that you want.
$main = '<div class="post-inner"><div class="entry"><p><strong><a href="http://example.net">link</a></strong></p></div></div>';
$doc = new DOMDocument();
$doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$anchors = $xpath->query('//div[contains(@class, "post-inner")]//a');
foreach ($anchors as $a) {
$a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue);
}
echo $doc->saveHTML();
Output:
<div class="post-inner"><div class="entry"><p><strong>
<a href="https://shortdomain.com/api?p=http://example.net">link</a>
</strong></p></div></div>
Demo on 3v4l.org
add a comment |
up vote
3
down vote
up vote
3
down vote
This is a good task for PHP's built-in DOMDocument and DOMXpath classes. Using xpath ensures that you only change anchors inside the div that you want.
$main = '<div class="post-inner"><div class="entry"><p><strong><a href="http://example.net">link</a></strong></p></div></div>';
$doc = new DOMDocument();
$doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$anchors = $xpath->query('//div[contains(@class, "post-inner")]//a');
foreach ($anchors as $a) {
$a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue);
}
echo $doc->saveHTML();
Output:
<div class="post-inner"><div class="entry"><p><strong>
<a href="https://shortdomain.com/api?p=http://example.net">link</a>
</strong></p></div></div>
Demo on 3v4l.org
This is a good task for PHP's built-in DOMDocument and DOMXpath classes. Using xpath ensures that you only change anchors inside the div that you want.
$main = '<div class="post-inner"><div class="entry"><p><strong><a href="http://example.net">link</a></strong></p></div></div>';
$doc = new DOMDocument();
$doc->loadHTML($main, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$xpath = new DOMXpath($doc);
$anchors = $xpath->query('//div[contains(@class, "post-inner")]//a');
foreach ($anchors as $a) {
$a->setAttribute('href', 'https://shortdomain.com/api?p=' . $a->attributes->getNamedItem('href')->nodeValue);
}
echo $doc->saveHTML();
Output:
<div class="post-inner"><div class="entry"><p><strong>
<a href="https://shortdomain.com/api?p=http://example.net">link</a>
</strong></p></div></div>
Demo on 3v4l.org
edited Nov 21 at 2:13
answered Nov 21 at 2:04
Nick
19.7k51434
19.7k51434
add a comment |
add a comment |
up vote
1
down vote
You can use the attribute selector with jquery to match all desired elements and then use the method 'attr' to change the href attribute.
$("#the-post > div.post-inner > div.entry > p > strong > a[href="http://example.net/"]")
.attr("href", "https://shortdomain.com/api?p=http://example.net/");
I didn't really test it, but it should work just fine.
add a comment |
up vote
1
down vote
You can use the attribute selector with jquery to match all desired elements and then use the method 'attr' to change the href attribute.
$("#the-post > div.post-inner > div.entry > p > strong > a[href="http://example.net/"]")
.attr("href", "https://shortdomain.com/api?p=http://example.net/");
I didn't really test it, but it should work just fine.
add a comment |
up vote
1
down vote
up vote
1
down vote
You can use the attribute selector with jquery to match all desired elements and then use the method 'attr' to change the href attribute.
$("#the-post > div.post-inner > div.entry > p > strong > a[href="http://example.net/"]")
.attr("href", "https://shortdomain.com/api?p=http://example.net/");
I didn't really test it, but it should work just fine.
You can use the attribute selector with jquery to match all desired elements and then use the method 'attr' to change the href attribute.
$("#the-post > div.post-inner > div.entry > p > strong > a[href="http://example.net/"]")
.attr("href", "https://shortdomain.com/api?p=http://example.net/");
I didn't really test it, but it should work just fine.
answered Nov 21 at 2:08
Pedro Lima
13416
13416
add a comment |
add a comment |
up vote
1
down vote
If you are doing this client-side, it's pretty painless with javascript's querySelectorAll:
let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>add a comment |
up vote
1
down vote
If you are doing this client-side, it's pretty painless with javascript's querySelectorAll:
let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>add a comment |
up vote
1
down vote
up vote
1
down vote
If you are doing this client-side, it's pretty painless with javascript's querySelectorAll:
let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>If you are doing this client-side, it's pretty painless with javascript's querySelectorAll:
let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>let as = document.querySelectorAll('#the-post .post-inner .entry p strong a')
as.forEach(a => a.href ="https://shortdomain.com/api?p="+a.href)<a href="http://example.net/">Don't change</a>
<div id="the-post">
<div class="post-inner">
<div class="entry">
<p>
change these:
<strong>
<a href="http://example2.net/">some inside </a> <br />
<a href="http://example3.net/">some other inside </a>
</strong></p>
</div>
</div>
</div>edited Nov 21 at 2:12
answered Nov 21 at 2:07
Mark Meyer
29.9k32549
29.9k32549
add a comment |
add a comment |
up vote
0
down vote
Get rid of the dummy website then.
$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
What happens with<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".
– miken32
Nov 21 at 2:13
then remove<a
– ACD
Nov 21 at 2:25
add a comment |
up vote
0
down vote
Get rid of the dummy website then.
$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
What happens with<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".
– miken32
Nov 21 at 2:13
then remove<a
– ACD
Nov 21 at 2:25
add a comment |
up vote
0
down vote
up vote
0
down vote
Get rid of the dummy website then.
$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);Get rid of the dummy website then.
$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);$main = get_the_content_with_formatting();
$stripped = str_replace('href="', 'href="https://shortdomain.com/api?p=', $main);edited Nov 21 at 2:25
answered Nov 21 at 2:04
ACD
51510
51510
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
What happens with<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".
– miken32
Nov 21 at 2:13
then remove<a
– ACD
Nov 21 at 2:25
add a comment |
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
What happens with<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".
– miken32
Nov 21 at 2:13
then remove<a
– ACD
Nov 21 at 2:25
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
I might be a bit slow for not thinking of this..
– John Doe
Nov 21 at 2:11
What happens with
<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".– miken32
Nov 21 at 2:13
What happens with
<a class="foo" href="...">. Or, for that matter, just with 2 spaces between "a and "href".– miken32
Nov 21 at 2:13
then remove
<a– ACD
Nov 21 at 2:25
then remove
<a– ACD
Nov 21 at 2:25
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404252%2fplacing-text-before-every-a-href-appearance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
you could use a DOM parser in php
– IdontDownVote
Nov 21 at 2:03
@IdontDownVote I thought about this, but it seems messy..
– John Doe
Nov 21 at 2:04
1
"Messy?" I'd submit that treating markup language like a plain text string is messy!
– miken32
Nov 21 at 2:09