Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

html link if/then


shadow31's Avatar
Member
0 0

hey everyone,

basically what I want this link to do is check to see if the src of a iframe within the website is equal to a given string and do something according to that. I just don't know the correct syntax for accessing information within an Iframe.

I know the overall syntax will look a little like this

<?=$page == "home" ? "class='active'" : ""?>

but I just dont know how to access the src of the iframe. the iframe has the id "content" if that has any impact. I was having a hard time finding the right wording for what I want this to do so google searches were pretty ineffective for me. If someone could shed some light or just point me to the link i probably overlooked that would be awesome


fashizzlepop's Avatar
Member
0 0

So you are using a PHP script to pull down a web page and in that you want to find what the src of the iframe is?


yours31f's Avatar
Retired
10 0

I'd recommend JS as PHP is server side.

document.getElementById('content').src = this;


spyware's Avatar
Banned
0 0

I'd use PHP, regex to grab the iframe's URL, then cURL/some other way to grab the source of that URL.