November 18th, 2012, 06:19 PM
Using curl to submit a form in an iframe on another page?
I've got some sample codes of curl, but i think it won't work with what i'm trying to do. Before i waste hours of time I want to make sure it can be done, that's why im asking it here.
I am using an iframe with my affiliate ID in it for a site that searches available flights. The iframe shows a search box form. Hit submit and the flights show upin the same iframe.
Now, for my site, I want the search form on one page and the search results on another page. This can't be done because everything is in an iframe out of my control.
I thought of this way to do it:
- Copy the iframe's form html and put that on 'mypage A'.
- When someone fills the form and hits submit, it goes to 'mypage B' where there's the original iframe.
- When the user has hit 'submit' on mypage A, the values he filled in must be copied to the original form in the iframe in mypage B and submit it.
I never used curl but I thought, when mypage A form is submitted it goes to the curl page.
Here the values get echoed in the post string.
Then the curl page posts the data to the iframe page in mypage B.
Here my problems start. Since i want mypage B show the search results which are in an iframe, to what url do I let curl post to?
Also, the search form holds my affiliate ID, but the results page has no ID. So when i do find a way to show the search results in mypage B with this, curl posts the data directly to the result page, which doesn't hold my affiliate ID. I guess it's getting a cookie from the search form. But when the iframe search form gets skipped and curl directly posts to the results page, my affiliate ID is also skipped and possibly a cookie containing it too.
I thought I had the solution until i ran into these problems.
I wonder if there's a way to get the result I want but I'm starting to doubt it, so I hope the people here can tell me if this is even possible.