Im Unable to iframe website https://www.discountedhunts.net/
https://www.cheapelkhunts.com/
plz help
What does that mean?
I guess its something to do with the security policy that won’t allow the page to be embedded in an iframe.
Hi there Atik1,
Many sites prevent their webpages being embedded in an
iframe, Google is one that comes immediately to mind.
Further rerading:-
Prevent web page from being loaded inside iFrame.
coothead
So whats solution
Are they both your sites and under your control?
If so change the security policy
Otherwise don’t do it .
If PHP is available then the page content may be available with curl(…) or wget (…) and string result could be pasted into a div.
I dont have backend access so
So don’t do it!
Hi there John,
would your suggestion possibly stumble over this…
<?php
header("Content-Security-Policy: frame-ancestors 'none'")
?>
…which is shown in the link I provided in post #4 ?
coothead
I justed tested with curl (…) and not only most surprised also very disappointed…
https://www.johns-jokes.com/downloads/sp-d/johnyboy-curl-test/?url=https://www.cheapelkhunts.com/
Further investigation
Revealed a 302 http response code redirected to a 403 http response code
The site owners don’t want their content scraped. Surely that’s their prerogative.
The site rendered OK, copying browser right-click->view-source-code and pasting into a html file - the file renders. I am most surprised that curl(…) would not read the contents and respects the http response code.
Yes I agree that it is their prerogative.
It just seems strange the browser reveals the source code and curl(…) fails to get the content.
curl may not be faking an acceptable user-agent.
But that said, we’re entering territory I’m uncomfortable with - the site clearly does not want its content put on other sites, and scraping to circumvent the site’s otherwise enforced desires smacks of an implied TOS violation.