![]() I don't know what specifically you are trying to embed, but if it expects things like cookies to be exchanged or things like that then you need to figure that out and set up cURL appropriately. One thing to keep in mind is that when you're using cURL through PHP, the web server is sending the request, not your browser. You have a habit of making incorrect assumptions though, so I bet the problem is not what you think it is, try to verify instead of making assumptions. Other than that, I don't have enough information to suggest what the problem might be. If you're not using a file URL, then I bet that's not the problem. I would not recommend putting an iframe with a file URL in an online page, notwithstanding the fact that it would only work for someone who has those actual files in that location on their computer. ![]() ![]() If you're using a URL that starts with something like "file://", then the browser is going to use a completely different security model. If CSS and images are missing, my money is on an incorrect path causing 404 errors.ΔΆ) The iframe src attribute is read differently depending on the source of the information (HTTP Request vs simple file address). If there are problems rendering the iframe content, the first step should be looking at your developer tools, particularly the network tab, to find out what requests are being sent for the contents of that iframe. Any difference you can identify between what works and what doesn't is not automatically the cause, there could be other factors you are not considering. I bet that headers are not the issue though, like I said I thinking you're barking up the wrong tree. The only header that I'm aware of which deals with frames in any way at all is a directive you can send to tell a browser that a certain page should not be embedded in a frame set. You think that sending HTTP response headers to the browser is going to alter how the browser renders that content? You're thinking a response header will have an effect on what the browser does with CSS or links? I'm not sure why you think that, but to answer your question I cannot think of any headers you can send to affect those things. How must I set the PHP header function to insure that the downloaded content is properly formatted into the src attribute of the iframe? The browser is obviously doing something that CURL is not. One further thought, once the proper MIME-TYPE is discovered where should it be entered? In the requesting CURL, at the top of the PHP document that is making the request, or somewhere else. Please understand that what I am requesting is a Matomo widget designed to display a certain body of dynamic knowledge that includes various kinds of images ranging from icon highlighting to functional maps. I was able to discover this via the using the CURLINFO_CONTENT_TYPE option suggested by the furtive fox. In the meantime I was able to discover that the content-type of the returned data is text/html charset=utf-8. How must I set the PHP header function to insure that the downloaded content is properly formatted into the src attribute of the iframe? Among other things the CSS styling and images are missing. Indeed, the same that works in an HTML document with the correct headers, does not work in a PHP file with no headers. ![]() I was falsely led to believe by own implementation that it would not make a difference. What I usually do - unformat my HTTP requests before sending - I did not do in this case. Removing the line breaks does perform a proper download and insert. And, what I am trying to do simply does not work. What is the necessary header argument required? I have tried both " QUESTION: If an image can be created by a PHP file and then read into the src attribute of an image tag, surely it must then also be possible to read the HTML content of a PHP file into the src attribute of an iFrame. Obviously, there is no difference in the URLs. (The absence of the authorization token assumes that the superuser has given access to all users the right to view whatever they like. Below is sample code taken directly from the Matomo website. OBJECTIVE: Read the data into a PHP file, and load the result into the src attribute of an iframe. As I, myself, do not yet know what to do with everything that Matomo makes available (it appears endless), I certainly do not want to put it all into the hands of others willy-nilly. For, to do so would require that I expose the authorization token that enables knowledgeable visitors of Matomo - and coding in general - the ability to view everything about my website that I am able to view. BACKGROUND: I would like to embed a Matomo widget into a page, but I dare not embed it directly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |