|
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Oct 2008
Posts: 4
|
Hi, I'm starting developing for the iPhone platform and I have a difficult task to do:
I have to find the way to send images from iPhone to a MySQL database in a server in the Internet. The server side code is written whit PHP and iPhone platform does not have support for PHP neither for MySQL. My question is: If the only way to send data is by web services, Which services are those? Is it an option to use XML parsing? Where should I start to look for the solution? Thanks for your help. |
|
|
|
|
|
#2 (permalink) |
|
Member
Join Date: Oct 2008
Posts: 31
|
Hi,
Yea you should use XMLs to send data for sure, and you should use XML parsing if you have to receive some data from server. You don't have MySQL on iPhone but you do have SQLight, you can read documentation for "sqlite3" or in the framework for iPhone i think it's called "libsqlite3.0.dylib". And for connecting via web use NSURL there is plenty explained in the documentation about this. Sergiu. |
|
|
|
|
|
#3 (permalink) |
|
Junior Member
Join Date: Oct 2008
Posts: 3
|
It doesn't matter what language the server-side stuff is in. It doesn't matter that there's no PHP on the iPhone. You're not going to do anything with PHP on the iPhone.
It doesn't matter that there's no MySQL on the iPhone. Your database stuff is done on the server. You won't be doing any MySQL stuff on the iPhone. You don't necessarily have to use XML to send the data. One way to send it would be to put it in the URL and use NSURL to create the URL and [NSString stringWithContentsOfURL] to send it and get a response. You'd hex-encode the data and send something like: "http://www.myserver.com/myreceiver.php?data=4F1AB736289EDC..." Your myreceiver.php would just look at the value of the data parameter, convert it to binary and store it in the database. Look at NSURL and NSURLConnection. Craig |
|
|
|
|
|
#5 (permalink) |
|
Junior Member
Join Date: Oct 2008
Posts: 4
|
Yep, I think that's a good idea, there are a class called NSData wich I can use for "encapsulate" the data.
- (NSData *)compress: (NSData *)data // IN { if (!data || [data length] == 0) return nil; // zlib compress doc says destSize must be 1% + 12 bytes greater than source. uLong destSize = [data length] * 1.001 + 12; NSMutableData *destData = [NSMutableData dataWithLength:destSize]; int error = compress([destData mutableBytes], &destSize, [data bytes], [data length]); if (error != Z_OK) { LOG(0, ("%s: self:0x%p, zlib error on compress:%d\n", __func__, self, error)); return nil; } [destData setLength:destSize]; return destData; } I've been trying to use this function but along with that I have other problems with the compiler, it says: warning: implicit declaration of function 'LOG' The same warning is also for functions 'NSAsert' and 'compress' I have definitions like: #define ASSERT(x) NSAsert(x, @"") #define Log(x,y) Maybe is just that some function that I use are not available for iPhone development or I need a library call.
__________________
Chl3g |
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.3.0 RC1 |






Linear Mode
