Verifying Page Contents From an iFrame or Remote Page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crazkanuk
Forum Newbie
Posts: 2
Joined: Tue Jun 07, 2005 10:03 pm
Location: Ontario, Canada
Contact:

Verifying Page Contents From an iFrame or Remote Page

Post 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
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post 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.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post 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.
crazkanuk
Forum Newbie
Posts: 2
Joined: Tue Jun 07, 2005 10:03 pm
Location: Ontario, Canada
Contact:

Post 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.
Post Reply