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
Posts: 39
Registered: ‎01-12-2012
My Device: Curve 9300
My Carrier: Telkomsel
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/
Highlighted
Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

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
Developer
Posts: 314
Registered: ‎03-28-2012
My Device: Curve 9360, Playbook, BB10 Dev Alpha
My Carrier: TMN

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
Developer
Posts: 410
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

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

Developer
Posts: 236
Registered: ‎07-27-2012
My Device: BlaclBerry PlayBook 16gb, BlackBerry dev alpha
My Carrier: Airtel

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