title: send device token to server
body: <p>I have read a lot of tutorials for this and i just wanted ti know if this is right way to do this</p>
  
  <pre><code>- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
  {
      NSLog(@"My token is: %@", deviceToken);
  
      NSString* newToken = [deviceToken description];
  
      newToken = [newToken stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"&lt;&gt;"]];
      newToken = [newToken stringByReplacingOccurrencesOfString:@" " withString:@""]; 
  
  
      NSString *urlString = [NSString stringWithFormat:@"http://myhost.com./filecreate.php?token=%@",newToken];
  
      NSURL *url = [[NSURL alloc] initWithString:urlString];
  
      NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
  
      NSData *urlData;
      NSURLResponse *response;
      urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&amp;response error:nil];
  
  }
  </code></pre>
  
  <p>any advices are more then welcomed.</p>
  
  <pre><code>- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
  {
  
      const char* data = [deviceToken bytes];
      NSMutableString* token = [NSMutableString string];
  
      for (int i = 0; i &lt; [deviceToken length]; i++) {
          [token appendFormat:@"%02.2hhX", data[i]];
      }
  
  
      NSString *urlString = [NSString stringWithFormat:@"http://myhost.com/filecreate.php?token=%@",token];
  
      NSURL *url = [[NSURL alloc] initWithString:urlString];
  
      NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];   
      NSData *urlData;
      NSURLResponse *response;
      urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&amp;response error:nil];
  
  }
  </code></pre>
  
  <p>My application works with both codes, but what's the right way?</p>