• 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
sending emails using URLRequest and php
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sending emails using URLRequest and php


  • Subject: sending emails using URLRequest and php
  • From: Reza Farhad <email@hidden>
  • Date: Thu, 16 Apr 2009 10:26:20 +0100

dear all

The issue has now been solved so here is the solution for all those that are interested:
You need to make your URL request pointing to your php script:
and through my frustration I had forgotten to add the call to get URL request sent out with URLConnection
so here it is in full


The script sendInfo.php:

<?php
  $message = $_REQUEST['message'] ;

  mail( "email@hidden", "Test Message", $message );
?>

and here is the code section in my cocoa app:

-( IBAction ) sendMail:( id )sender
{
NSString *post = @"message=testing";
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:@"http://www.qu-s.eu/ sendInfo.php"]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
[ NSURLConnection connectionWithRequest:request delegate:self ];
}


Thanks again to all and may I again refer interested people to this blog which has more information

http://deusty.blogspot.com/search/label/NSURLRequest

Reza






_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: sending emails using URLRequest and php
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Setting up an auxiliary task for use with Distributed Objects
  • Next by Date: Re: Best way to get a non-repeating random number?
  • Previous by thread: Re: sending emails using URLRequest and php
  • Next by thread: Re: sending emails using URLRequest and php
  • Index(es):
    • Date
    • Thread