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

Java Development

Reply
Developer
Posts: 95
Registered: ‎03-22-2009
My Device: Torch 9800 & Bold 9700

http get

Hi there,

 

I want to send some data like the following to a php page:

http://www.website/index.php?msg=Hello

 

How do I call this without using a web browser on the Blackberry?

 

Thanks!

 

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: http get

You create an HTTP connection.

 

See the HTTPDemo source that ships with the JDE sample programs, and review this sticky thread:

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=29103

 

Developer
Posts: 95
Registered: ‎03-22-2009
My Device: Torch 9800 & Bold 9700

Re: http get

[ Edited ]

Hi

 

Yea I used some of the code from that example:


 

try {
s = (StreamConnection)Connector.open("http://www.website.com/index.php?msg=999999999");
httpConn = (HttpConnection)s;
}

catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

 

 However its not working.

When I go through the browser on the simulater it works fine!

 

Any thoughts?

Thanks

 

Message Edited by grahamb314 on 06-10-2009 02:11 PM
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: http get

Did you start MDS? This is required if you are doing an HTTP connection to simulates a BES network (i.e., no connection suffix).

 

You can go direct TCP on the simulator if you add ";deviceside=false" to your URL.

 

Did you review the sticky thread I linked above? All is explained.

 

Contributor
Posts: 28
Registered: ‎11-13-2012
My Device: none

Re: http get

Hi, how do I display the data of the php results?
Developer
Posts: 16,495
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: http get


RexDoug wrote:
You can go direct TCP on the simulator if you add ";deviceside=false" to your URL.

direct would be ;deviceside=true.

In any case, it is better to use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/device/api/io/transport/ConnectionFactory...

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter