Jump to content

Form Poster - Wait Time

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
This problem doesn't seem to have an answer so I'll ask it in here. I've been working on it for about a day :irritated:.

I created a "form submitter" type of program that loads a webpage in an iFrame using PHP. The PHP reads data from a text file and then passes that data to JavaScript function that then loads the webpage src and then submits the data (fills in the input fields).

The problem here is that the JavaScript tries to fill in the data before the HTML is loaded in the iFrame. I'm tried using the onload event in the iFrame to kick-off the second function:


parent.fr1.document.onload= submit(data);


This seems to do the same as if I would just call the function. The onload event doesn't wait for the HTML to load!

How can I or what event can I use to tell the function not to submit until the HTML is loaded?

I also tried using the sleep() function in PHP. This halts the entire program. If there is a "doevents" in PHP I could loop that for about 10 seconds but I know of none. Any ideas?

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I don't know of an event other than onload and this may not be the best method but it is just an idea of mine. You could read the source of the iFrame and do a loop until you see some ending tag (such as </body>). I know of no method similar to Application.DoEvents() in PHP.

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Honestly, I've read this:

Quote

I created a "form submitter" type of program that loads a webpage in an iFrame using PHP. The PHP reads data from a text file and then passes that data to JavaScript function that then loads the webpage src and then submits the data (fills in the input fields).

about 10 times, and still cant figure out what you are trying to do.

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
He is loading up a page in an iFrame and then trying to submit data to the form elements, I think. But the problem is that the PHP tries to enter the data before the iFrame finishes loading the page. Is that correct?

#5
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I was under the impression that he was parsing data from a text file using php, using JavaScript to fill in a form with that data, and then use JavaScript to submit the form, at the instance the page loads.

So why not just use php to parse the data, and use php to submit the data?