Iphone - Insert Imagedata Into Database From XCode Using JSON?

Nov 29, 2010

How to insert/store images in MySQL database from XCode via PHP using JSON?

View 1 Replies


Iphone - Xcode Send Data From Text Input Through A Post Function?

Is it possible to send text from an xcode input and have the data sent through a php function?

View 2 Replies

Iphone - Sending Http Request Using Method Post To A Mobile Application That Is Using Objective C (.xcode)

I am working on project that is taking the data from a voiceXML application and then the voiceXML application send the variable that contains the data into a .php and I am done with that part but the problem is when I want to send the variable by sending a HTTP POST Request from .php to the mobile application which is installed on the iphone that is written using objective C programming language with an extension (.xcode), I faced a problem in receiving the variable on the mobile application,

So what I tried to do for a couple of months is to send the variable first to another .php and if it works with me, I will try to fixed the problem with mobile application. I used httpRequest () Class - method post in order to send variable but the problem is that I don't know what to write on the other .php file to receive this variable and then display it. This is the whole code :


I used the database as a buffer since I am working on different sessions which is between the .VXML and first .php or the first .php and second .php The form.php contains the following which just display a white page and doesn't print the variable that is coming from the first .php:


So what I have to do in order to receive the variable correctly and display it in the second php?

View 1 Replies

IPhone App/JSON - Posting Data To Remote Database?

I have an iPhone app that uses ASIHTTPRequest to post data to a php file, which then uses sql to update the database accordingly.What's bugging me is I keep reading that I should encode my posted data in JSON format. Can somebody explain to me the point in this? Why should I encode in JSON format? What are the benefits, needs for this..


View 2 Replies

Iphone - Newline In Text - UITextView To Sqlite - Sqlite To JSON (via NSString) - JSON To It

I have a UITextView that ends up sending the text to a sqlite db on the iPhone. Later on I will be querying this data from sqlite, putting it into a JSON string and sending it to a server (PHP/MySQL) from the iPhone using ASIHTTPRequest (using ASIFormDataRequest class). There is a data condition where this send to PHP fails to decode properly (using json_decode). The data condition seems to be where there's a newline in the text that was entered to sqlite via the UITextView.

Things I've Tested: Write out the same JSON string that I'm trying to send to the server to a text file on the iPhone. Take that text, copy it into a web form (that I put together for this troubleshooting) that POSTs the data to the same PHP script that accepts the JSON from the iPhone. This processes successfully (e.g. decodes and writes to the MySQL db). Write out the same JSON string that I'm trying to send to the server to the console (using NSLog). Copy the text from the console and copy it into a web form that POSTs the data to the same PHP script that accepts the JSON from the iPhone. This processes successfully (e.g. decodes and writes to the MySQL db).

Remove the newline in the sqlite db, run the app and send the JSON to the server per design, no problem...it decodes and writes to the MySQL db. I want to keep the newline in the text as that is what the user typed and what they will expect when they see the information on the server. Not sure how to keep the newline and at the same time be able to send the data to the server without any issues.

View 1 Replies


I'm looking to call a HTTP_POST from the iPhone SDK to a php file on my server. If I call this below:


Should I be able to receive this post data like so (in php):

echo "Hello";
echo $_POST['test'];


To test, in my connectionDidFinishLoading I'm simply logging the whole response
- (void)connectionDidFinishLoading:(NSURLConnection *)conn
NSString *responseString = [[NSString alloc] initWithData:dataRecieved encoding:NSASCIIStringEncoding];
[dataRecieved release];
NSLog(@"Response: %@", responseString);

I get the hello that I echoed before looking for the post, but nothing else. Does anyone know where I'm going wrong?

View 3 Replies

Iphone - Garbage After JSON - Array - YQL

i'm using YQL to send data back to an iPhone app i'm developing. I've got a JSON parser on the iphone and a PHP page on my webhost. This is the PHP:

header('Content-type: application/json');
$arr = array();
$result = $_GET["q"];
$yql_base_url = "http://query.yahooapis.com/v1/public/yql";
$yql_query = "select * from search.web where query ='%s'"; //YQL query to retrieve search results
$value = "lindsay+lohan";

When i use my iphone app and attempt to retrieve it, it says "Json parse failed: Garbage after JSON" And if i run the PHP file in a browser, i see all the JSON data fine but after it there is "[1]", which is screwing it up i think?

View 1 Replies

Iphone JSON-Framework EOF Error?

I'm attempting to use Json-Framework to parse output (on the iPhone) from my website. The data on the website is an array of news objects... passed through PHP's json_encode().The JSON Output is here:[URL]....I am able to conne to the server and store the JSON data, then I do:

NSString *jsonString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];

View 1 Replies

Google/twitter Search From Iphone Using Json?

header('Content-type: application/json');
$json = file_get_contents("http://twitter.com/status/user_timeline/lindsaylohan.json?count=1");
$temp = json_decode($json);
$array = Array();
$array[] = $temp;
echo json_encode($array);

I have a JSON parser in my iphone app. I'm using the above PHP code to try and search Twitter. Can anyone tell me the best way to search the web or get twitter results and return them to my app? I've tried YQL but could not get on with it. All i want is raw text returned to my app. Almost like RSS feeds

View 1 Replies

JSON Encoding - Get MySQL Data To An IPhone?

Im new to JSON and have whats probably a basic question. I have some MySQL rows I want grab with Php, and then JSON encode for a response to an iphone request.

1) Whats the format for the array to encode this info?

2) Where the does the response code (200) fit into it?

View 2 Replies

Get Json Data From Iphone Post Request?

I am developing an iPhone App using JSON framework, I am calling a PHP script to update MySQL database on local server. Using these code:

NSString *jsonString = [sendData JSONRepresentation];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
NSString*post = [NSString stringWithFormat:@"&json=%@", jsonString];
NSData*postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:NO];
[request setURL:[NSURL URLWithString:@"http://localhost:8888/update.php"]];

I would like to ask: What is the PHP script to get data from that request, and how I can decode JSON data to PHP object to update to database?

View 3 Replies

Iphone - JSON Return String Options?

I don't know any PHP so another developer helped me out with this code. I am trying to return the names of all the files in a folder on my server. These are then passed to my iPhone app which uses the data. However, I have 160 files in the folder and the JSON string only returns 85. Is there something wrong with this code:

$path = 'Accepted/';

View 2 Replies

Send An Array Of Object From IPhone App To A Script With JSON?

I have an iPhone app with an array of objects that I want to send to a PHP script and have them be stored in a mySQL database. The objects in the array contain only floating points and strings, nothing special.

From what I understand the best way to send the array to the php script is to convert the array into an JSON, send it to the php script via http post, and do a json_decode on the other end. However I'm having a hard time figuring out how to convert the array into a json object.

View 3 Replies

IPhone - Send JSON Object To Server In POST?

I would like to send my contact list with all numbers for each numbers. I'm trying to send a JSON Object (with all my data) to a PHP file and to decode with the json_decode function. Is it possible to use JSON to send to a server by POST in HTTPrequest

View 3 Replies

MySql Table Returning JSON That Needs Formatting For IPhone UITableview

I have a php query the returns the following JSON format from a table.


View 1 Replies

Objective C - More Specific About Sending Json With Utf8 To Iphone From Server?

We have php server that sends json string in utf-8 encoding. Im responsible for the iphone app that get the data. I want to be sure that on my side everything is correct :

//after I downlad the data stream :
NSString* content = [[NSString alloc] initWithData:self.m_dataToParse encoding:NSUTF8StringEncoding];
//here the data is shown correctly in the console
SBJsonParser *_parser = [[SBJsonParser alloc]init];
NSDictionary *jsonContentDictionary = [_parser objectWithData:self.m_dataToParse];
//here, when i printer values of array IN array, i see u454 u545 4545 format. any ideas why ?

im using the latest version of json library : [URL] There is problem is the iphone side? (json parser? ) or in the php server?

just to be clear again :
1.on the console, before json, the string looks o.k
2.after doing json, the array in array values are in the format of u545 u453 u545

View 1 Replies

Get Imagedata As Binary String?

I'm using a solution for assembling image files to a zip and streaming it to browser/Flex application.(ZipStream by Paul Duncan, [URL]

Just loading the image files and compressing them works fine. Here's the core for compressing a file:

// Reading the file and converting to string data
$stringdata = file_get_contents($imagefile);
// Compressing the string data
$zdata = gzdeflate($stringdata );


View 1 Replies

Write The Server Side If Using The Json On Client Side Of The Iphone?

i want to make my server side in php. after writing the code in php can i directly use json to parse it of or something other required on the server side with php.can you give me some example of it, how to do this on server side if i want to use json of my client side.

View 3 Replies

Print Imagedata From String Variable

I got a windows com executable which returns a jpg image in a BSTR.

Let's say, the var that holds the data is $imgData.

With perl, in a cgi script, I may simpy write:
$| = 1;
print "Content-type: image/jpeg

print $imgData;
and the Image is propperly printed to the Client-Browser.

Now I want to achieve the same with php, but I just can't find a way to
treat the data as binary instead of a formated string.
As far as I know, echo $imgData shouldn't expect a formated string, as print

(I know, returning a Safearray from the com executable would be a better way
and probably I will also do it that way, but at the moment, I'm trying to
solve this problem.)

View 7 Replies

PHP And Xcode?

Does anyone know of a way to make Apple's Xcode editor do syntax
highlighting and tooltips for PHP functions? I found some hacks for the old
Project Builder, but they don't seem to work with Xcode.

View 1 Replies

Iphone SDK - Upload Image From Iphone To A Server Send Empty File?

I try to send a photo and GPS location to server via PHP here is the PHP part:Copy from here Saving the Uploaded File The examples above create a temporary copy of the uploaded files in the PHP temp folder on the server. The temporary copied files disappears when the script ends. To store the uploaded file we need to copy it to a different location:

if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 20000))
if ($_FILES["file"]["error"] > 0)


The script above checks if the file already exists, if it does not, it copies the file to the specified folder.

Note: This example saves the file to a new folder called "upload"

now back to iOS part ,I only can send GPS location to server ,it's easy because just a string. and you can download sample code here But an image is not,I do some search and found this discussion I directly put the code in my send GPS&image button the best thing is it can feedback I send the file success or failed

this is the most message I got after I send photo to server

1.Invalid file

2.Return Code: Upload: Type: Size: 0 KbTemp file: Stored in: upload/

I follow some guide to save image to NSData

NSData *photoData= UIImageJPEGRepresentation(self.theimageView.image, 1.0);

and I also check there is data inside or not so simply add this code into Button action

if (photoData == nil) {
NSLog(@"The photo is nothing !!!");
else {
NSLog(@"Photo inside !!!!");

But How To Upload An Image To Server ??? maybe I need to give a file name then upload it ???but how to...

I never use camera function and upload data before Hope someone can figure out this problem

View 4 Replies

Download Database To Iphone?

The app I'm writing needs to get information from a remote database and then store it in the SQlite database on the iphone for offline use. As of now I'm using a php script to querry the database and then just basically scrapping the html data from the php echo calls. My problem is that now that I'm moving away from test data I'm using database tables that are fairly large with complex dependencies. I would really like to not to have to write a parser for these complex files to manually put the data and dependencies into the iphone database.My question is if there is any way to use a php script to pass to the iphone a copy the actual database file and then just dump that into the SQlite database on the iphone.

View 2 Replies

IPhone - Notify Some Subscribers When The Database Changes

I have three things: An iPhone app PHP-mySQL database on a server Google App Engine (?) The iPhone app is working fine storing data in the database. I'd like to notify some subscribers when the database changes (i.e. someone uploads something). I assume the app is running, so I just want the view up to date. (Also, is it feasible to send push notifications when is not running?)

View 1 Replies

Access Something From A SQLite Database On An IPhone?

I have a database that I recently converted from MySQL to SQLite. I have a PHP script that gets a string from a POST or GET Request and looks for that string and returns a value in that row.

$newNumber = $_REQUEST['new'] ;
$tbl_name = 'roomNumbers';
$sql="SELECT * FROM $tbl_name WHERE new='$newNumber'";


It doesn't get passed the if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {

View 1 Replies

Iphone Online Database Connection Objective C?

right I am planning to make an application that connects to an online database to a certain website i have developed using php.the site uses MYSQL.anyways how would i allow the application on my iphone update and receive records from one of the tables with the ability to delete records aswell.I am fairly new to programming on my iphone.

View 2 Replies

Export Data From Online Database To Iphone?

I am trying to make an xml file to export my data from my database to my iphone. Each time I create a new post, I need to execute a php file to create a xml file containing the latest post Here is current php code ... but my nsxmlparser gives me an error code (33 - String is not started).

// dition du dÈbut du fichier XML
$xml .= '<?xml version="1.0" encoding="UTF-8"?>';
$sml .= '<channel>';
$xml .= '<title>Infonul</title>';


I noticed a few things when i open 20news.xml in my browser : I got squares instead of single quotes ... I can't see <[CDATA[ but ]]> is clearly visible ... why ?!?

View 4 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved