How to: get dimensions of page opened by php script?
Posted: Thu Dec 03, 2009 12:13 pm
Hi, I am new here and am am not a "professional" developer of any sort. Except for some introductory computer science courses at my university, I am mostly self taught so please excuse my ignorance and inexperience.
Background:
I remember once learning some PHP, but whatever I learned I forgot and so I am here today to ask a simple question. Also, I know HTML, CSS, and Javascript and I've just started looking into AJAX (seems pretty simple so far). I know Python, Java, and C++.
Question:
I want to do something that I know is pretty clunky and unprofessional, but is the easiest to implement solution (I can find) that does what I need. I want to create an iframe that loads cross domain content and while doing so, adjusts its size to the page it loads. I have decided to use a PHP proxy which seems simple enough. I believe my server settings for PHP will not give me problems with this. I have a simple proxy does the basic thing of getting the cross domain page content, but I dont know how get simple information from the content such as height width of the body. Now I understand that I could just stuff the content into a div, but since I want the frame to axcess any page on the web, the proxy will be an open proxy which can then be taken advantage of by user with possibly ill intentions. So, I am limiting the php script to only getting height and width informations. Again, how do I get this information?
This is the example I am basing my proxy from.
<?php
// Set your return content type
header(Content-type: application/xml);
// Website url to open
$daurl = http://feeds.feedburner.com/jQueryHowto;
// Get that website is content
$handle = fopen($daurl, "r");
// If there is something, read and return
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>
Excuse my round about way of explaining myself.
Background:
I remember once learning some PHP, but whatever I learned I forgot and so I am here today to ask a simple question. Also, I know HTML, CSS, and Javascript and I've just started looking into AJAX (seems pretty simple so far). I know Python, Java, and C++.
Question:
I want to do something that I know is pretty clunky and unprofessional, but is the easiest to implement solution (I can find) that does what I need. I want to create an iframe that loads cross domain content and while doing so, adjusts its size to the page it loads. I have decided to use a PHP proxy which seems simple enough. I believe my server settings for PHP will not give me problems with this. I have a simple proxy does the basic thing of getting the cross domain page content, but I dont know how get simple information from the content such as height width of the body. Now I understand that I could just stuff the content into a div, but since I want the frame to axcess any page on the web, the proxy will be an open proxy which can then be taken advantage of by user with possibly ill intentions. So, I am limiting the php script to only getting height and width informations. Again, how do I get this information?
This is the example I am basing my proxy from.
<?php
// Set your return content type
header(Content-type: application/xml);
// Website url to open
$daurl = http://feeds.feedburner.com/jQueryHowto;
// Get that website is content
$handle = fopen($daurl, "r");
// If there is something, read and return
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>
Excuse my round about way of explaining myself.