Page 1 of 1

Verifying Page Contents From an iFrame or Remote Page

Posted: Tue Jun 07, 2005 10:19 pm
by crazkanuk
I was hoping that someone might be able to suggest a good way to accomplish the following in PHP:

From the main site the user selects check boxes and submits a form. I plan on nesting the logic within a for each statement that will iterate through each of the checkbox selections and submit the forms to various, remote signup pages. However, before moving to the next iteration I would need to verify that the form has been submitted successfully.

I thought about doing this via a small/hidden iframe and attempting to retrieve the page contents from the iframe into the main frame. I was able to write a class which reads the page contents of a remote URL, but if that URL is dynamic or based on the form values, I may also require those.

Does anyone know of a way to retrieve the contents of an iFrame in any way? Otherwise can anyone suggest how to carry this out? I'd even appreciate any theories that you might be able to suggest.

Thanks in advance.

CrazKanuk

Posted: Wed Jun 08, 2005 2:35 am
by Syranide
This isn't really PHP at all if I understand you correctly, and yes there are ways to do this, however JScript is fairly complicated when it comes to retrieving things out of parents and other frames (especially as it doesn't always allow such things because of possible abuse, such as you can only access from the same domain and so on).

Go look up some JScript-forum or so.

Posted: Wed Jun 08, 2005 3:41 am
by CoderGoblin
As far as I can understand your requirement, why deal with hidden information in an "iframe" where it could cause complications, be hard to debug errors or potentially lead to a method of abuse?

As an alternative methodology, when submitting the checkboxes store the form "names/ids" required in a session as an array. You can then process them, each in turn, deleting the "name/id" from the array when each form is complete/finished. You could also potentially use this array to produce a menu or even a "wizard" interface.

Posted: Wed Jun 08, 2005 12:20 pm
by crazkanuk
Syranide wrote:...because of possible abuse, such as you can only access from the same domain and so on).
Abuse?? On the Internet???? Lol, well I was thinking this might be the case. As a last resort I've actually asked that they provide a second set of pages which redirect back to a php page to confirm. Not a huge deal I suppose, but as per the development methodologies, "why spend 5 minutes doing something that would work find when you can spend 5 days automating it!" :)

Thanks for the help. JS might work, but like you say not in all instances. I've thought about running a PERL script behind it also, but thought PHP might be neater. Thanks again.