Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 945719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:47:54+00:00 2026-05-15T22:47:54+00:00

i wrote a gps-application for the iphone and it all works fine but now

  • 0

i wrote a gps-application for the iphone and it all works fine but now i want to send the latitude and longitude to a server over the internet using the most simple way… I have a url from the server in which there are parameters for latitude and longitude. Also i want the lat. and long. to be sent every 90 seconds or so. How exactly is all of this done? Any help is much appreciated, thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:47:54+00:00Added an answer on May 15, 2026 at 10:47 pm
    NSURL *cgiUrl = [NSURL URLWithString:@"http://yoursite.com/yourscript?yourargs=1"];
    NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:cgiUrl];
    
    /* leave the rest out if just issuing a GET */
    NSString *postBody = @"yourpostbodyargs=1";
    
    NSString *contentType = @"application/x-www-form-urlencoded; charset=utf-8";
    int contentLength = [postBody length];
    
    [postRequest addValue:contentType forHTTPHeaderField:@"Content-Type"];
    [postRequest addValue:[NSString stringWithFormat:@"%d",contentLength] forHTTPHeaderField:@"Content-Length"];
    [postRequest setHTTPMethod:@"POST"];
    [postRequest setHTTPBody:[postBody dataUsingEncoding:NSUTF8StringEncoding]];
    /* until here - the line below issues the request */
    
    NSURLConnection *conn = [NSURLConnection connectionWithRequest:postRequest delegate:self];
    

    handle errors and received data using:

    - (void)connectionDidFinishLoading:(NSURLConnection *)connection
    {
        // data has the full response
    }
    
    - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
    {
        contentLength = [response expectedContentLength];
    }
    
    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)newdata
    {
        [data appendData:newdata];
    }
    
    -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
    {
    }
    

    you need some variables set up, such as data, contentLength etc. But this is the general outline for http interaction.

    You may want to put all handling stuff in a separate handler class, I changed the delegate to self so this is more self-contained.

    As for timing, use an NSTimer to invoke posting the data every 90 seconds:

    [NSTimer scheduledTimerWithTimeInterval:90 target:self selector:@selector(xmitCoords) userInfo:nil repeats:YES];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is the code i wrote to retrieve the latitude, longitude but it is
I wrote simple NMEA parser and I'm reading latitude and longitude from GPS. Values
I am newbie. I wrote a class, that implements service and uses gps, but
I have to transform GPS coordinates (latitude and longitude) to a Lambert Conformal Conic
I have an client server application on Android.And I have to send data from
I wrote a very small web application that sends your GPS coordinates to a
I wrote a process explorer using C with GUI interface. I want to add
I wrote a simple XML file and a DTD file including an entity, but
I wrote a collada loader for my model viewer. Write now it loops through
I have to write an application for iphone that tracks the movement of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.