AW: AW: [Zope] Source from form result.

Marc Fischer marcbpc@gmx.de
Thu, 3 May 2001 10:48:24 +0200


> [Marc Fischer]
>
> > Ok, I will try to explain. ... Somewhere in the Web, there is a Website,
> out
> > of the world of zope:-), that provides a form with a submit button. this
> > form passes some arguments with the syntax:
> > <input type="hidden" name="x" value="y"> ...
> >
> > If you klick on submit button, you get displayed some pictures.
> so far so
> > good ...
> >
> > I want to create a zope application, that automatically gets
> the source of
> > this result page, extracts the urls of the picutres and finally uploads
> > these pictures into my zopeserver.
>
> [Tom]
> You mean, you have a web page hosted in Zope, you click a button or
> something on it, and the pictures end up in Zope with no more
> human actions?

NO, it is an external webpage!(NO ZOPE, not mine) There is a form with a
submit button. If I submit, I get the result page. On this page are included
pictures. I want the source code of this page, in order to extract the
included picture urls, and automatically upload those pics in my ZOPE
Server!


> [Marc]
> >
> > The problem is, that it is not possible to pass the variables in the url
> > like this:
> > http://server/index.html?x=y.
> >
> >
> [Tom]
> I don't know what you mean here, why can't you include the
> variables in the
> url?  Where would you like to include the variables but find it can't be
> done?

I don't know why. But the php script (on the external server) which is call
by <form action="script.php" ... with the submit button, does not publish
the same result, if I pass the variables over the url!


> [Marc]
> > So I am looking for a way of being able to handle the source
> code of this
> > result. Extraction of the urls is not a problem.
> >
> [Tom]
> Do you want to do this for a single site that always sends the
> same html, or
> a range of sites that are similar but not identical?

Just one single site!

> I would think about using an External Method.  That would let you use the
> Python httplib library.  With httplib , you could get the form by
> issuing an
> HTTP GET command on the remote server.  Then you could use the
> form to build
> the right url (including the "?x=y")

will not work ;-(

>, and then issue another GET on that
> url. This would get you the html for the page - that is the
> source you asked
> for - from which you could extract all the image urls.  This wouldn't work
> if the form runs some javascript to set its variables, though, since your
> Python program wouldn't be able to figure out what the javascript
> was doing.
>
> Alternatively, if the form you want has a name assigned to the
> form element
> (or even if you knew its position among all the forms on the page), you
> could create a browser window with two frames and load the form
> into one of
> them.  From the other one, using Javascript, you could cause the form to
> load the page that has the pictures.  Then, again with
> javascript, you could
> walk through its images array and get all the urls.  Then you could load
> these urls into form variables and, using javascript, send the
> form with the
> pictures' urls to Zope.  From there, it ought to be possible to
> get Zope to
> upload the pictures.

that would be a possibility, if I dont have success in the more
automatically way :-)

> If you were clever with the design, you could get your page to do
> this on a
> list of sites, or on a list of picture selections.
>
> I think this would be feasible using either Netscape or Internet Explorer,
> but certainly with IE.
>
> We're talking about a lot of work experimenting and developing, though, if
> you don't know these techniques already.  How many images do you want to
> capture?  Maybe it would be faster to do them by hand, one at a time.
> Zope maillist  -  Zope@zope.org

We are talking about nearly 20 pictures, that change a few times a day. My
script should be called a few times a day, too. New Pictures should
automatically be inserted in my ZOPE.

Marc