• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Open safari and send post variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Open safari and send post variables


  • Subject: Re: Open safari and send post variables
  • From: Yorh <email@hidden>
  • Date: Fri, 9 Jun 2006 14:41:21 +0200

Hi and thank you for the support,

Your code of course works... but I need to open safari and print the variables I sent (with php).
I know how to do it with php, but i write:


NSURL *someUrl = [NSURL URLWithString:@"http://www.test.org/ test.php"];

NSURLConnection * theConnection;
NSMutableURLRequest* postURLRequest = [NSMutableURLRequest requestWithURL:
someUrl];


	//Make it a post
    [postURLRequest setHTTPMethod:@"POST"];

	//Set the body for the post
    [postURLRequest setHTTPBody:[@"test=foo"
	dataUsingEncoding:NSISOLatin1StringEncoding]];

//Start the connection with the post
theConnection=[[NSURLConnection alloc] initWithRequest:postURLRequest
delegate:self];
[[NSWorkspace sharedWorkspace] openURL:someUrl];


It doesn't works.
I used a sniffer to get the packets and all seems sent by my app...

How can I do?
Thanks
Yorh

On 09/giu/06, at 13:44, Conor Dearden wrote:

As you stated NSURLConnection is what you want; you just have to look at the
documentation a bit longer:


file:///Developer/ADC Reference Library/documentation/Cocoa/ Reference/Fo
undation/Classes/NSURLRequest_Class/Reference/Reference.html


The post part would be this:

//Create a request
NSMutableURLRequest* postURLRequest = [NSMutableURLRequest requestWithURL:
[NSURL URLWithString:@"http://www.apple.com/search";]];


//Make it a post
    [postURLRequest setHTTPMethod:@"POST"];

//Set the body for the post
    [postURLRequest setHTTPBody:[@"search=SomethingHere"
dataUsingEncoding:NSISOLatin1StringEncoding]];

//Start the connection with the post
theConnection=[[NSURLConnection alloc] initWithRequest:postURLRequest
delegate:self];



You will have to read up on NSURLConnection on how to implement the delegate
methods for reading the data.


Conor
www.bruji.com


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40metagraphics.it


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Open safari and send post variables
      • From: Conor Dearden <email@hidden>
    • Re: Open safari and send post variables
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >Re: Open safari and send post variables (From: Conor Dearden <email@hidden>)

  • Prev by Date: Re: FrontRow remote control events
  • Next by Date: Re: Open safari and send post variables
  • Previous by thread: Re: Open safari and send post variables
  • Next by thread: Re: Open safari and send post variables
  • Index(es):
    • Date
    • Thread