Jump to content
Larry Ullman's Book Forums

Php Code Allow Smartphone Applications (Iphone, Android) To Connect To My Website To Log In And Receive Data?


Recommended Posts

Hello all,

 

I would like my website to will allow my smartphone application to log into it and access data from it. What is the relevant section of the book for this? Would it be Web Services? Sockets?

 

For example suppose I have a website that allows people to store lists of interesting things they've seen in stores, and to share these lists with other users, and I want to write an iPhone application that would allow people to update their lists via their iPhone. On the server side, would I set this up as a web service like in Chapter 10 of the book? Can you recommend other resources to learn more about how to do this?

 

Many thanks!

Link to comment
Share on other sites

If you want users to access your site from a web browser on their smartphone, then there is no additional code you need to write. The code would be the same for the desktop version and the smartphone version.

The only likely thing you'd want to change is making the smartphone version easier to view (than the desktop version) on a smartphone.

 

If, instead, you want to write a native app for iPhone and Android devices, then I suggest you by a book about how to write iPhone and Android apps (which use two separate languages), because PHP is not going to help you there.

  • Upvote 3
Link to comment
Share on other sites

  • 3 weeks later...

Hello HartelySan,

 

Thanks for this. I have learned iOS development, so I can write iPhone apps. I just want to know how I can access my website's database using via iOS (Objective C) code. For example, think about the Facebook or Twitter App on the iPhone. One doesn't access facebook or twitter on the iPhone using a browser, but instead using the respective application. So I would like to do the same thing - I would like to write an application to compliment my PHP website, so users would log in to the app using the same username and password that they use to log into the website (just like facebook, twitter, etc.). This is a different matter then designing the website to accomodate access from a smartphone. Would you have any ideas of how I could learn how to do the former?

 

Cheers,

Shafique

Link to comment
Share on other sites

It's basicly the same thing as in PHP. There are some small differences though. PHP has a MySQL library integrated alongside PDO and the MySQLi extension. In C#, you have to download a library called Connector/NET version 6.1 and import it into your project. This is the same as when you use PEAR/similar to download extensions for PHP.

 

Once this is integrated into your project, you should build a class that handles all operations on the Database, including connection and CRUD-operation.

 

This is a great tutorial by the looks of it. I've never done this in C#, but I have done so in Java. It looks like a well written article. I did a serch for "C# mysql" to find it. One important thing to notice. Notice the "Adding Reference and Creating the MySQL Connector DLL from the Project". That is very important. Without that step, the users must have the Connector/NET version 6.1 installed to use your app.

 

http://www.codeproje...nect-C-to-MySQL

 

Ask questions if you need help. I'm not very familiar with C#, but I should be able to help out anyhow. A C# forum would really be my best guess if you need real help.

Link to comment
Share on other sites

 Share

×
×
  • Create New...