Using WebClient

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Using WebClient

garduino
Hi:

I'm trying to automate some operations on a web page that requires
authentication.

I managed to arrive to the form that I need to process, authenticated
without problems.

But I can't figure out how to process the button (is a button of this type:

<input class="lButton" style="" name="submit_search"
value="Create File" type="submit"> )  to execute the Create File action.

The form have two dates (that I can calculate and fill in) but I can't
to imagine how to process the submit button programmatically.

Any hint will be appreciated.

Cheers.

--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

Stéphane Ducasse
if you get answers from squeak-dev let us know.


Stef


On May 29, 2010, at 10:02 PM, Germán Arduino wrote:

> Hi:
>
> I'm trying to automate some operations on a web page that requires
> authentication.
>
> I managed to arrive to the form that I need to process, authenticated
> without problems.
>
> But I can't figure out how to process the button (is a button of this type:
>
> <input class="lButton" style="" name="submit_search"
> value="Create File" type="submit"> )  to execute the Create File action.
>
> The form have two dates (that I can calculate and fill in) but I can't
> to imagine how to process the submit button programmatically.
>
> Any hint will be appreciated.
>
> Cheers.
>
> --
> =================================================
> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
> Arduino Software & Web Hosting   http://www.arduinosoftware.com
> PasswordsPro  http://www.passwordspro.com
> =================================================
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

Schwab,Wilhelm K
It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.


________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
Sent: Saturday, May 29, 2010 4:14 PM
To: [hidden email]
Subject: Re: [Pharo-project] Using WebClient

if you get answers from squeak-dev let us know.


Stef


On May 29, 2010, at 10:02 PM, Germán Arduino wrote:

> Hi:
>
> I'm trying to automate some operations on a web page that requires
> authentication.
>
> I managed to arrive to the form that I need to process, authenticated
> without problems.
>
> But I can't figure out how to process the button (is a button of this type:
>
> <input class="lButton" style="" name="submit_search"
> value="Create File" type="submit"> )  to execute the Create File action.
>
> The form have two dates (that I can calculate and fill in) but I can't
> to imagine how to process the submit button programmatically.
>
> Any hint will be appreciated.
>
> Cheers.
>
> --
> =================================================
> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
> Arduino Software & Web Hosting   http://www.arduinosoftware.com
> PasswordsPro  http://www.passwordspro.com
> =================================================
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

garduino
I think that is a post method in this case, but can't make it work (yet).

2010/5/29 Schwab,Wilhelm K <[hidden email]>:

> It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.
>
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
> Sent: Saturday, May 29, 2010 4:14 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] Using WebClient
>
> if you get answers from squeak-dev let us know.
>
>
> Stef
>
>
> On May 29, 2010, at 10:02 PM, Germán Arduino wrote:
>
>> Hi:
>>
>> I'm trying to automate some operations on a web page that requires
>> authentication.
>>
>> I managed to arrive to the form that I need to process, authenticated
>> without problems.
>>
>> But I can't figure out how to process the button (is a button of this type:
>>
>> <input class="lButton" style="" name="submit_search"
>> value="Create File" type="submit"> )  to execute the Create File action.
>>
>> The form have two dates (that I can calculate and fill in) but I can't
>> to imagine how to process the submit button programmatically.
>>
>> Any hint will be appreciated.
>>
>> Cheers.
>>
>> --
>> =================================================
>> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
>> Arduino Software & Web Hosting   http://www.arduinosoftware.com
>> PasswordsPro  http://www.passwordspro.com
>> =================================================
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

garduino
Talking of post method, I tried to capture it with Firebug to
understand what data post with WebClient, but no way until now.

Exist some trick to obtain the exact content of the data to post only
debuggin the web page?

Cheers.


2010/5/29 Germán Arduino <[hidden email]>:

> I think that is a post method in this case, but can't make it work (yet).
>
> 2010/5/29 Schwab,Wilhelm K <[hidden email]>:
>> It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
>> Sent: Saturday, May 29, 2010 4:14 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] Using WebClient
>>
>> if you get answers from squeak-dev let us know.
>>
>>
>> Stef
>>
>>
>> On May 29, 2010, at 10:02 PM, Germán Arduino wrote:
>>
>>> Hi:
>>>
>>> I'm trying to automate some operations on a web page that requires
>>> authentication.
>>>
>>> I managed to arrive to the form that I need to process, authenticated
>>> without problems.
>>>
>>> But I can't figure out how to process the button (is a button of this type:
>>>
>>> <input class="lButton" style="" name="submit_search"
>>> value="Create File" type="submit"> )  to execute the Create File action.
>>>
>>> The form have two dates (that I can calculate and fill in) but I can't
>>> to imagine how to process the submit button programmatically.
>>>
>>> Any hint will be appreciated.
>>>
>>> Cheers.
>>>
>>> --
>>> =================================================
>>> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
>>> Arduino Software & Web Hosting   http://www.arduinosoftware.com
>>> PasswordsPro  http://www.passwordspro.com
>>> =================================================
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> =================================================
> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
> Arduino Software & Web Hosting   http://www.arduinosoftware.com
> PasswordsPro  http://www.passwordspro.com
> =================================================
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

Schwab,Wilhelm K
You can do a simple "man in the middle attack" on yourself.  One approach would be to set up your own web server, serve the page with the form to a "real" browser and see what it sends when you submit the form.  There is probably also a way to do it with a proxy of some sort, either off the shelf or one you write to log traffic both ways, and then you quickly get a picture of how the conversation works.  A network sniffer might be another option.

I have had to do things like this with either network or serial port traffic at various times.  A few years back, an engineer with a medical device manufacturer was late delivering something that we happened to need at a time that was inconvenient for him.  The solution: blame the confusion on the customer (me), of course, and hope that he could later give us something that might make things "easier" on us (which would be a working version of their new software).  It got pretty ridiculous shortly before he had to admit that it didn't work.  The funny thing was that their demo program for the "new protocol" was using something that looked exactly like the old one :)  I was able to show that because I wrote a replacement for their device and connected their program to it: it was obviously not doing what he was claiming.

Bill

________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Germán Arduino [[hidden email]]
Sent: Monday, May 31, 2010 1:39 PM
To: [hidden email]
Cc: The general-purpose Squeak developers list
Subject: Re: [Pharo-project] Using WebClient

Talking of post method, I tried to capture it with Firebug to
understand what data post with WebClient, but no way until now.

Exist some trick to obtain the exact content of the data to post only
debuggin the web page?

Cheers.


2010/5/29 Germán Arduino <[hidden email]>:

> I think that is a post method in this case, but can't make it work (yet).
>
> 2010/5/29 Schwab,Wilhelm K <[hidden email]>:
>> It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.
>>
>>
>> ________________________________________
>> From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
>> Sent: Saturday, May 29, 2010 4:14 PM
>> To: [hidden email]
>> Subject: Re: [Pharo-project] Using WebClient
>>
>> if you get answers from squeak-dev let us know.
>>
>>
>> Stef
>>
>>
>> On May 29, 2010, at 10:02 PM, Germán Arduino wrote:
>>
>>> Hi:
>>>
>>> I'm trying to automate some operations on a web page that requires
>>> authentication.
>>>
>>> I managed to arrive to the form that I need to process, authenticated
>>> without problems.
>>>
>>> But I can't figure out how to process the button (is a button of this type:
>>>
>>> <input class="lButton" style="" name="submit_search"
>>> value="Create File" type="submit"> )  to execute the Create File action.
>>>
>>> The form have two dates (that I can calculate and fill in) but I can't
>>> to imagine how to process the submit button programmatically.
>>>
>>> Any hint will be appreciated.
>>>
>>> Cheers.
>>>
>>> --
>>> =================================================
>>> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
>>> Arduino Software & Web Hosting   http://www.arduinosoftware.com
>>> PasswordsPro  http://www.passwordspro.com
>>> =================================================
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> =================================================
> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
> Arduino Software & Web Hosting   http://www.arduinosoftware.com
> PasswordsPro  http://www.passwordspro.com
> =================================================
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

garduino
Thanks by the response Bill.

I investigated a bit more and found Tamper, a firefox extension to
view and modify HTTP/HTTPS headers and post parameters.

Then I discovered that this form that I need to deal with, use
multipart/form-data and I must deal also with boundaries
(http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html). I'm reading
a bit more to fully understand this stuff and may be the WebClient is
usable as is or I can modify it to this sort of use. I will comment
when have more news.

Thanks again by the help.

Germán.



2010/6/1 Schwab,Wilhelm K <[hidden email]>:

> You can do a simple "man in the middle attack" on yourself.  One approach would be to set up your own web server, serve the page with the form to a "real" browser and see what it sends when you submit the form.  There is probably also a way to do it with a proxy of some sort, either off the shelf or one you write to log traffic both ways, and then you quickly get a picture of how the conversation works.  A network sniffer might be another option.
>
> I have had to do things like this with either network or serial port traffic at various times.  A few years back, an engineer with a medical device manufacturer was late delivering something that we happened to need at a time that was inconvenient for him.  The solution: blame the confusion on the customer (me), of course, and hope that he could later give us something that might make things "easier" on us (which would be a working version of their new software).  It got pretty ridiculous shortly before he had to admit that it didn't work.  The funny thing was that their demo program for the "new protocol" was using something that looked exactly like the old one :)  I was able to show that because I wrote a replacement for their device and connected their program to it: it was obviously not doing what he was claiming.
>
> Bill
>
> ________________________________________
> From: [hidden email] [[hidden email]] On Behalf Of Germán Arduino [[hidden email]]
> Sent: Monday, May 31, 2010 1:39 PM
> To: [hidden email]
> Cc: The general-purpose Squeak developers list
> Subject: Re: [Pharo-project] Using WebClient
>
> Talking of post method, I tried to capture it with Firebug to
> understand what data post with WebClient, but no way until now.
>
> Exist some trick to obtain the exact content of the data to post only
> debuggin the web page?
>
> Cheers.
>
>
> 2010/5/29 Germán Arduino <[hidden email]>:
>> I think that is a post method in this case, but can't make it work (yet).
>>
>> 2010/5/29 Schwab,Wilhelm K <[hidden email]>:
>>> It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.
>>>
>>>
>>> ________________________________________
>>> From: [hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
>>> Sent: Saturday, May 29, 2010 4:14 PM
>>> To: [hidden email]
>>> Subject: Re: [Pharo-project] Using WebClient
>>>
>>> if you get answers from squeak-dev let us know.
>>>
>>>
>>> Stef
>>>
>>>
>>> On May 29, 2010, at 10:02 PM, Germán Arduino wrote:
>>>
>>>> Hi:
>>>>
>>>> I'm trying to automate some operations on a web page that requires
>>>> authentication.
>>>>
>>>> I managed to arrive to the form that I need to process, authenticated
>>>> without problems.
>>>>
>>>> But I can't figure out how to process the button (is a button of this type:
>>>>
>>>> <input class="lButton" style="" name="submit_search"
>>>> value="Create File" type="submit"> )  to execute the Create File action.
>>>>
>>>> The form have two dates (that I can calculate and fill in) but I can't
>>>> to imagine how to process the submit button programmatically.
>>>>
>>>> Any hint will be appreciated.
>>>>
>>>> Cheers.
>>>>
>>>> --
>>>> =================================================
>>>> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
>>>> Arduino Software & Web Hosting   http://www.arduinosoftware.com
>>>> PasswordsPro  http://www.passwordspro.com
>>>> =================================================
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> =================================================
>> Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
>> Arduino Software & Web Hosting   http://www.arduinosoftware.com
>> PasswordsPro  http://www.passwordspro.com
>> =================================================
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Using WebClient

Andreas.Raab
Hi Germán -

Sorry I missed this discussion earlier. First of all, looking at the
page should give you all the information you need to derive the basic
parameters for the html form submission (see [1]). The "action"
attribute of the form tag will tell you the URL for the request; the
"method" attribute will tell you what HTTP method to use (GET/POST;
default is GET) and the "enctype" attribute what encoding to use
(default is application/x-www-form-urlencoded).

Armed with this information you can set up your HTTP request properly.
I've started to add utility methods for this in WebClient (fetch the
latest version straight from http://squeaksource.com/WebClient). With
this version you can now do some simple form submissions like Googling
for Squeak in English:

        WebClient
                htmlSubmit: 'http://www.google.com/search'
                fields: {
                        'hl' -> 'en'.
                        'q' -> 'Squeak'
                }

Unfortunately, it currently doesn't support multipart/form-data since I
have no experience with these encodings. If you figure it out, drop me a
note (or better: some code :-) for how to do it, and I'll add it.

[1] http://www.google.com/search?q=html+form+tag

Cheers,
   - Andreas

On 6/1/2010 6:48 PM, Germán Arduino wrote:

> Thanks by the response Bill.
>
> I investigated a bit more and found Tamper, a firefox extension to
> view and modify HTTP/HTTPS headers and post parameters.
>
> Then I discovered that this form that I need to deal with, use
> multipart/form-data and I must deal also with boundaries
> (http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html). I'm reading
> a bit more to fully understand this stuff and may be the WebClient is
> usable as is or I can modify it to this sort of use. I will comment
> when have more news.
>
> Thanks again by the help.
>
> Germán.
>
>
>
> 2010/6/1 Schwab,Wilhelm K<[hidden email]>:
>> You can do a simple "man in the middle attack" on yourself.  One approach would be to set up your own web server, serve the page with the form to a "real" browser and see what it sends when you submit the form.  There is probably also a way to do it with a proxy of some sort, either off the shelf or one you write to log traffic both ways, and then you quickly get a picture of how the conversation works.  A network sniffer might be another option.
>>
>> I have had to do things like this with either network or serial port traffic at various times.  A few years back, an engineer with a medical device manufacturer was late delivering something that we happened to need at a time that was inconvenient for him.  The solution: blame the confusion on the customer (me), of course, and hope that he could later give us something that might make things "easier" on us (which would be a working version of their new software).  It got pretty ridiculous shortly before he had to admit that it didn't work.  The funny thing was that their demo program for the "new protocol" was using something that looked exactly like the old one :)  I was able to show that because I wrote a replacement for their device and connected their program to it: it was obviously not doing what he was claiming.
>>
>> Bill
>>
>> ________________________________________
>> From: pharo-project-bounces-bM+ny+RY8h+a+bCvCPl5/[hidden email] [[hidden email]] On Behalf Of Germán Arduino [[hidden email]]
>> Sent: Monday, May 31, 2010 1:39 PM
>> To: Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>> Cc: The general-purpose Squeak developers list
>> Subject: Re: [Pharo-project] Using WebClient
>>
>> Talking of post method, I tried to capture it with Firebug to
>> understand what data post with WebClient, but no way until now.
>>
>> Exist some trick to obtain the exact content of the data to post only
>> debuggin the web page?
>>
>> Cheers.
>>
>>
>> 2010/5/29 Germán Arduino<[hidden email]>:
>>> I think that is a post method in this case, but can't make it work (yet).
>>>
>>> 2010/5/29 Schwab,Wilhelm K<[hidden email]>:
>>>> It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.
>>>>
>>>>
>>>> ________________________________________
>>>> From: pharo-project-bounces-bM+ny+RY8h+a+bCvCPl5/[hidden email] [[hidden email]] On Behalf Of Stéphane Ducasse [[hidden email]]
>>>> Sent: Saturday, May 29, 2010 4:14 PM
>>>> To: Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>>>> Subject: Re: [Pharo-project] Using WebClient
>>>>
>>>> if you get answers from squeak-dev let us know.
>>>>
>>>>
>>>> Stef
>>>>
>>>>
>>>> On May 29, 2010, at 10:02 PM, Germán Arduino wrote:
>>>>
>>>>> Hi:
>>>>>
>>>>> I'm trying to automate some operations on a web page that requires
>>>>> authentication.
>>>>>
>>>>> I managed to arrive to the form that I need to process, authenticated
>>>>> without problems.
>>>>>
>>>>> But I can't figure out how to process the button (is a button of this type:
>>>>>
>>>>> <input class="lButton" style="" name="submit_search"
>>>>> value="Create File" type="submit">  )  to execute the Create File action.
>>>>>
>>>>> The form have two dates (that I can calculate and fill in) but I can't
>>>>> to imagine how to process the submit button programmatically.
>>>>>
>>>>> Any hint will be appreciated.
>>>>>
>>>>> Cheers.
>>>>>
>>>>> --
>>>>> =================================================
>>>>> Germán S. Arduino<gsa @ arsol.net>     Twitter: garduino
>>>>> Arduino Software&  Web Hosting   http://www.arduinosoftware.com
>>>>> PasswordsPro  http://www.passwordspro.com
>>>>> =================================================
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-project mailing list
>>>>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>>
>>>
>>> --
>>> =================================================
>>> Germán S. Arduino<gsa @ arsol.net>     Twitter: garduino
>>> Arduino Software&  Web Hosting   http://www.arduinosoftware.com
>>> PasswordsPro  http://www.passwordspro.com
>>> =================================================
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/[hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Using WebClient

garduino
Unfortunately the customer cancelled the project (He selected an
automation solution
using ActiveX, but automating the IE. My proposal was talking directly with the
http server and make a service and so, but well....are the business :) ).

Anyway I got very interested by this topic and will try to give a try
to the implementation
of the post method using multipart boundaries when time permit (This
topic is already on
my near-to-infinite-todo list).

Cheers.
Germán.


2010/6/2 Germán Arduino <[hidden email]>:

> Hi Andreas:
>
> Thanks by the comments.
>
> I will continue with the multipart stuff, because this may become a
> payed work for a local customer.
>
> Indeed I could do the job with other tools but in most of cases that
> means install a gazillion of different pieces of software of third
> parts that are complex to make work. I prefer to develop my own
> solution, even with a bit more of work, but completeley Smalltalk.
> Then I can deploy on the customer a self containded service that I can
> extend as the customer need.
>
> I'm now reading about multipart/form-data enctype and will try to
> develop this feature for WebClient (if the customer don't cancel the
> project).
>
> Will send the news.
>
> Cheers.
> Germán.
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: Using WebClient

garduino
Hi People:

I was playing a bit with this stuff and reading the RFC
(http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html) I managed the
way to upload a file using a POST method that requires
multipart/form-data.

My method is:


httpPost: urlString fileToUpload: aFile

        "Example POST method to upload a file (text/plain) over a multipart
form on the example url http://cgi-lib.berkeley.edu/ex/fup.cgi"
        "See also: http://cgi-lib.berkeley.edu/ex/fup.html and more details
about multipart/form-data variations on:
http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html "
        "aFile is a common ascii file"

        | boundaryChar idBoundary boundary postData file contentType |
       
        boundaryChar := '---------------------------'.
        idBoundary := self createIdBoundary.
        boundary := boundaryChar, idBoundary.

        contentType := 'multipart/form-data; boundary=', boundary.

        file := CrLfFileStream readOnlyFileNamed: aFile.
       
        postData := '--', boundary, String crlf,
        'Content-Disposition: form-data; name="upfile"; filename="', aFile,
'" Content-Type: text/plain', String crlf, String crlf,
        file contents, String crlf,
        '--', boundary, String crlf,
        'Content-Disposition: form-data; name="note"', String crlf, String crlf,
        'Smalltalk Upload Test File', String crlf,
        '--', boundary, '--', String crlf.
       
        ^self httpPost: urlString content: postData type: contentType do:[:req]


#createIdBundary return a value to use as idBoundary.

And this method may be called as:

(WebClient new httpPost: 'http://cgi-lib.berkeley.edu/ex/fup.cgi'
fileToUpload: 'test.txt') getContent

The drawback is that I can't imagine a solution to anything because
each form may be different and with different fields and names.

I used Firebug to understand how was the post to this site (and any
other) and then build the multipart data accordingly.

Cheers.
Germán.






2010/6/2 Germán Arduino <[hidden email]>:

> Unfortunately the customer cancelled the project (He selected an
> automation solution
> using ActiveX, but automating the IE. My proposal was talking directly with the
> http server and make a service and so, but well....are the business :) ).
>
> Anyway I got very interested by this topic and will try to give a try
> to the implementation
> of the post method using multipart boundaries when time permit (This
> topic is already on
> my near-to-infinite-todo list).
>
> Cheers.
> Germán.
>
>
> 2010/6/2 Germán Arduino <[hidden email]>:
>> Hi Andreas:
>>
>> Thanks by the comments.
>>
>> I will continue with the multipart stuff, because this may become a
>> payed work for a local customer.
>>
>> Indeed I could do the job with other tools but in most of cases that
>> means install a gazillion of different pieces of software of third
>> parts that are complex to make work. I prefer to develop my own
>> solution, even with a bit more of work, but completeley Smalltalk.
>> Then I can deploy on the customer a self containded service that I can
>> extend as the customer need.
>>
>> I'm now reading about multipart/form-data enctype and will try to
>> develop this feature for WebClient (if the customer don't cancel the
>> project).
>>
>> Will send the news.
>>
>> Cheers.
>> Germán.
>>
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project