Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 7
Registered: ‎02-15-2011
My Device: 9800 torch

How can I build WebWorks Apps with JSON and PHP for the server side??

Hi I'm Indra a beginner developer of BlackBerry WebWorks Application

 

Here is the scenario...

 

I want to building a Blackberry WebWorks (widget) that is used as a portal to a remote website. Most of the pages are remote. Last time I chat with Adam Stanley (astanley) in BlackBerry Devcon Asia is about if I want to build an application in webworks so that my application can retrieve data from web server included with database like mysql. He told me to build an application with JSON and just using PHP in my server. Well right now I'm so desperate on how an BlackBerry application can connect to a web server (my private server not from RIM)?

 

If I'm not bothering you guys,, please give me the link to resolve my problem. And/or please give me a sample code for the client side and server side on how to communicate each other using JSON? I've search for it and google still give the java sample application not webworks application. Thank you for your time and I'm sorry if my english is look terrible.

 

Please mail or reply for this message if you can resolve my problem. Thank You.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Hi there,

 

I'm not sure I understand what specifically you are trying to accomplish.

 

Do you want to build a WebWorks application to simply open and view your remote web page running on your web server?  And this remote website is built using PHP?

 

Just trying to clarify Smiley Happy

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 7
Registered: ‎02-15-2011
My Device: 9800 torch

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Well what i'm going into is that I want the WebWorks App on the phone itself can parse the data from my server. My server is built with Apache using PHP and MySQL. In my application it should be the data from MySQL come out and I can display it on the WebWorks App in my schema. Mr. Adam Stanley told me that I must using JSON to bring the data to my application. But the problem is how can WebWorks Application get the data from my server. From the theory it must be easy,, but in the code itself, HOW ? What API and how can I use it? Need the sample code.... Smiley Indifferent

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Getting the data back to your application is accomplished via using AJAX and XMLHttpRequest.  I have a post about how I tackled this process in .NET.  It won't map one-to-one but the same concepts can be applied to PHP.

 

http://supportforums.blackberry.com/t5/Web-Development/How-quot-I-quot-would-call-a-web-service-from...

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 7
Registered: ‎02-15-2011
My Device: 9800 torch

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Well,, I must thank you for your help and atention..

But honestly I can't understand what your .NET page trying to do... It because my lack experiences of other languanges. I really don't know how to bring the data using JSON to my App with PHP syntax.

I'm sorry... Smiley Wink

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

This article would be a good start:

 

http://davidwalsh.name/web-service-php-mysql-xml-json

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 7
Registered: ‎02-15-2011
My Device: 9800 torch

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Yeahh,, I think so...

 

Maybe it a good start.

Well,, It is almost dawn right now in my local time.

Maybe tomorrow if it working I will give the solution to my problem so other people like me can fix their problem. I wish it could happen that way..

By the way thank you for your help. Other persons from RIM that I know doesn't give me any helps because they are very busy or on vacation. Smiley Wink

Developer
Posts: 71
Registered: ‎02-04-2011
My Device: Blackberry Bold & Pearl
My Carrier: Telecom NZ

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Hey indrakusumax, You're question is too vague, I think you need to get onto google and read up on the following:

JSON in PHP

JSON in Javascript

XMLHttpRequest object in Javascript

 

The concepts to do what you want are not in the webworks API but are standard in HTML, Javascript, and PHP so finding tutorials on the internet even if they don't relate to webworks will help. To learn this you don't need to compile the application or test it on the playbook virtual machine, you can test it in any modern browser with Chrome being the best platform for testing apps that will end up on the playbook.

 

You may also benifit from using frameworks like jquery or prototype for javascript because they have done most of the heavy lifting for you, there are numerous frameworks in PHP like the Zend framework and cake but I don't have much experience with those so can not recommend.

 

Ultimately you have alot of reading ahead of you plenty of trial and error and perhaps some hair pulling out moments, once you've got a hang of things you should come back here with some specific questions you will find more help then.

 

Good luck.

New Developer
Posts: 7
Registered: ‎02-15-2011
My Device: 9800 torch

Re: How can I build WebWorks Apps with JSON and PHP for the server side??

Hi,,

I was busy yesterday and I can't post any messages because of that...

well.. I was tried to build application using XML (not JSON) and it's work.

Later on, I will try to parse the JSON format so my problem will solved soon.

If I successed, I will bring the simple source code for you all...

Yoo Smiley Wink