0

Is their any way to store the nsmutablestring into server side. I had done below coding.:-

NSData *data = [NSKeyedArchiver archivedDataWithRootObject: attributedString];


    NSString *Str=[NSString stringWithFormat:@"http://ahd.medma.tv/suman/testv/testformat.php?mystring=%@",data];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:Str]
                                                           cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
                                                       timeoutInterval:10];
    [request setHTTPMethod: @"GET"];

    NSError *requestError;
    NSURLResponse *urlResponse = nil;

    NSData *response1 = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];

    NSString* newStr = [[NSString alloc] initWithData:response1 encoding:NSUTF8StringEncoding];

    NSLog(@"responses===>%@",newStr);

But then how to convert the nsdata into attributedtext into backend side in PHP ?

Please help me

ios developer
  • 3,363
  • 3
  • 51
  • 111
  • Have a look at this answer: http://stackoverflow.com/a/21583127/623396 – user623396 Nov 07 '14 at 12:55
  • @user623396 thanks for the answer.But it stores the data into HTML format.Where it is not possible to do all the taging in proper way – ios developer Nov 07 '14 at 12:57
  • Then I guess you'll have to write your own conversion methods. – user623396 Nov 07 '14 at 12:59
  • @user623396 I want to send nsattribtedstring to server.You are saying i will convert that into HTML and then will send to server? – ios developer Nov 07 '14 at 13:01
  • If you just want to store it on the server and then restore it later on the client you can use the opposite method **[NSKeyedUnarchiver unarchiveObjectWithData:data]** – user623396 Nov 07 '14 at 13:03
  • @user623396 but what should i use on the PHP side to covert NSDATA into HTML or some string..so that it will return me the same.also it will be used to display in the website. – ios developer Nov 07 '14 at 13:11
  • Yes, convert the attributed string to HTML before sending it to the server.Then convert the HTML back to NSAttributedString. – user623396 Nov 07 '14 at 13:15

0 Answers0