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
Contributor
blazaphyrocqua
Posts: 39
Registered: ‎01-12-2012
My Device: Curve 9300
Accepted Solution

How to use PHP file in webworks

Hello,

How do I use PHP in webworks? I heard that we have to configure the access in config.xml? This is what is in my xml: 

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0.0">
<name>test</name>
<access subdomains="true" uri="*" required="true" />
<content src="http://localhost/Forex/checklogin.php"/>
<content src="index.html"/>
</widget>

Then calling it from local to server):
Username : <input type=text name=myusername id=myusername> <br>
Password : <input type=password name=mypassword id=mypassword> <br>
<input type=button value=Login name=Submit Onclick="location.href='http://localhost/Forex/checklogin.php'">
Baru di checklogin.php (server ke local):
 
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.html"
session_register("myusername");
session_register("mypassword"); 
header("location:HTML/login_success.html");
}
else {
echo "Wrong Username or Password";
 
}
Anyone can told me how does it suppose to be?
PS: The local file is saved in Forex/HTML/ or Forex/PHP/ while index.html is in Forex/
Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: How to use PHP file in webworks

Hi,

PHP is a server-side technology, meaning, it runs on the webserver, not on the browser. I don't think you can use local PHP files in a webworks app.

 

Nuno

Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Developer
nunodonato
Posts: 313
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha

Re: How to use PHP file in webworks

Sorry, I understand now what you meant. You are trying to establish a connection to a server-side php page, right?

You can do that, but then I guess the user will be out of your app. Not sure if there is a way to "get back in".

What I can think of is doing the request by AJAX, so you process the results inside the app. To do that you need access to the php file to code it appropriately.

 

nuno

Nuno
theBBthing.wordpress.com - my BlackBerry development blog: news, tips and tutorials
bitoutsidethebox.com - re-imagining digital solutions


Please use plain text.
Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: How to use PHP file in webworks

You can have only one <content src="">

 

Then you add authorization to access your's server php file:

<access uri="http://localhost/Forex/checklogin.php" subdomains="true">
<feature id="blackberry.ui.dialog"/>

<ANY FEATURE call from by javascript from this file>

</access>

 

You can access from and to your server file with redirection to these url:

http://localhost/Forex/checklogin.php

local:///WebContent\localFile.html

Please use plain text.
Developer
WebCreep
Posts: 236
Registered: ‎07-27-2012
My Device: BlaclBerry PlayBook 16gb, BlackBerry dev alpha

Re: How to use PHP file in webworks

use a linux server in which u can run the php files and use iframe codes to display it in webwork apps

 

to buy hosting in less price with 100% uptime call me on +91 9900989797 or visit http://webcreep.in

Please use plain text.