just do a GET style form submit: formAction?arg1=foo&arg2=bar - This is like submitting a form whose action is formAction, with two fields named arg1 and arg2 with values in those fields of foo and bar.

don't forget to urlEncode if you have spaces or special characters

for more complex stuff, use /Developer/Examples/TCPMonitor. You can capture the content of the form submission from a web browser to see exactly how it is composed...

abc

On Jul 28, 2006, at 4:09 AM, David Griffith wrote:

Thanks, I had actually figured out that much, the problem is how to specify the form values in the request that is sent... The 'content' part is the bit I can't figure out.

Regards,
David.

On 27 Jul 2006, at 20:00, Alex Cone wrote:


On Jul 27, 2006, at 12:44 PM, webobjects-dev- [EMAIL PROTECTED] wrote:

Subject: Re: WOHTTPConnection & WORequest
To: "Jerry W. Walker" <[EMAIL PROTECTED]>

Hi Jerry,

Well, I have no control over the other website. What I need to do is
this:

In my own WO App, I have a page which displays some information from
the database about a domain name and who it is associated with.


Before you guys get too carried away...

sounds like what you want to do is submit a "GET" style form request like:

        http://www.someDomain.com/doSomething?arg1=foo&arg2=bar

trivial example off the top of my head...

public String sendUrlToHostOnPort(String urlString, String host, int port) {
        NSData content = null;

WOHTTPConnection connection = new WOHTTPConnection(host, port)); NSDictionary headers = new NSDictionary(new Object[] {"text/html", "text/html"}, new Object[] {"Accept", "Content-Type"}); WORequest request = new WORequest("GET", urlString, "HTTP/ 1.0", headers, content, null);

        connection.sendRequest(request);
        WOResponse response = connection.readResponse();

        if (response == null) {
            System.out.println("WOResponse object is null");
            return null;
        }

        NSData contentData = = response.content();
        if (contentData == null) {
System.out.println("No content in the WOResponse object");
            return null;
        }

       return new String(contentData.bytes(0, contentData.length()));
}


HTH!

abc

__alex cone
        ceo  c o d e f a b  inc
        [EMAIL PROTECTED]
        212.465.8484 x101
        http://www.codefab.com

If you are not living on the edge, you are taking up too much space.



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/david% 40infinityspain.com

This email sent to [EMAIL PROTECTED]




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to