There is a portion of a website that I would like to include in my website. I could attempt to use an iframe however I believe this would not be the best approach. Is there a way to embed a portion of a website based on the CSS ID?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Theoretically, yes – you could fetch the external page using PHP, separate the element using a HTML parser, and show only the element’s HTML.
However, you would lose all styling information using this approach, because the HTML will be rendered in your local page’s context. Mixing your own and an external site’s styles will often lead to chaos.
Unless you really need just the pure HTML markup from the external site, you may be best off with an iframe.