PHP and Websockets

Morgisto

Well-Known Member
Joined
Oct 29, 2012
Messages
161
Reaction score
2
Location
In a Tree
I must admit I know nothing about PHP.What I do know is I need to find someone that know their way around PHP and Websockets.

In short I need a programme on my desktop to communicate with my website server. I have google a lot and have realised I need to get the above.

Regards Morgs
 
you need a windows app to communicate to a web server? for what purpose. to monitor health?
 
No we actually are intending to sell a program via a monthly subscription. An Id number will be put into the clients profile on the server and the app on the client desktop will confirm subs and cancel login after 30 days.

Regards
 
No we actually are intending to sell a program via a monthly subscription. An Id number will be put into the clients profile on the server and the app on the client desktop will confirm subs and cancel login after 30 days.

Regards

A websocket connection for something like that seems a bit overkill. Why not just a REST service on the server with the app phoning home at intervals (or at start time)?
 
A websocket connection for something like that seems a bit overkill. Why not just a REST service on the server with the app phoning home at intervals (or at start time)?

Agreed. From what you are describing, you do not want to do a websocket interface. It will be much too complicated and total overkill for what you want to achieve. What you want to do is create a rest interface (API) on your web server and the call it from your desktop app. See this thread for a discussion from an Android perspective, but the same things apply in your case:
http://mybroadband.co.za/vb/showthr...g-to-an-External-Database-System-(VPS-Server)
 
Gracious thx for the help. Sadly that android thread seem amazing .I'll still need to find someone e to help me.

Regards
 
So you need to actually know both windows api programming and php. That's going to be rather more complicated. Why can't people just login from a browser?
 
Here:


Server (go):

Code:
package main

import "github.com/gin-gonic/gin"

func main() {
    r := gin.Default()
    r.GET("/subscribe", func(c *gin.Context) {
        c.JSON(200, gin.H{
            "message": "You are subscribedz0red",
        })
    })
    r.Run() 
}

Java:

Code:
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import org.apache.log4j.Logger;

public abstract class Api {
    public Api() {
    }

    final public String Client(String endpoint) {
        try {
            Client client = Client.create();

            WebResource webResource = client.resource(endpoint);

            ClientResponse response = webResource.accept("application/json").get(ClientResponse.class);

            if (response.getStatus() != 200) {
                throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
            }

            return response.getEntity(String.class);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
}

There is a basic thing to work from.
 
So you need to actually know both windows api programming and php. That's going to be rather more complicated. Why can't people just login from a browser?

Well i am unfortunately not at all good when it comes to programming. But if i may explain it this way.

You as the member registers and buys a subscription on my forum.
1. You have an ID in your profile which is obviously stored on my forum/website server.
2. You pay R X.XX amount for a prescription which last 30days.
3 Everytime you login to the program or app the login page is enabled only if you have a valid subscription-- or else it will return "you are not subscribed"

My skype name is fastrack1696 if anybody thinks they could be of assistance id rather explain on a chat platform

thx all so far for the helpful comments

regards

Morgs
 
Well i am unfortunately not at all good when it comes to programming. But if i may explain it this way.

You as the member registers and buys a subscription on my forum.
1. You have an ID in your profile which is obviously stored on my forum/website server.
2. You pay R X.XX amount for a prescription which last 30days.
3 Everytime you login to the program or app the login page is enabled only if you have a valid subscription-- or else it will return "you are not subscribed"

My skype name is fastrack1696 if anybody thinks they could be of assistance id rather explain on a chat platform

thx all so far for the helpful comments

regards

Morgs
Ok, it sounds all the more like you don't want an app unless the app is just an extra means of using it. This isn't something new and most forum software would allow it. Only the login page has to be there for it to authenticate. It makes no sense to disable it as there would be no way to then determine if the person has a valid subscription.
 
Ok, it sounds all the more like you don't want an app unless the app is just an extra means of using it. This isn't something new and most forum software would allow it. Only the login page has to be there for it to authenticate. It makes no sense to disable it as there would be no way to then determine if the person has a valid subscription.

I don't think his English (or what he wants to achieve) is very well laid out.

Whatever it is, people already suggested a good solution. a RESTful API that accepts certain parameters to determine if the person trying to login has a valid subscription or not, regardless of interface.

Meaning, he can have an android login page, a web login page, a windows application login, all pointing and asking "does login user xyz trying to login to the app, have a valid subscription?"

What he means by "login page enabled only if you have a valid subscription" is that a person cannot enter the app with no valid subscription after trying a username/password combination.

Read between the lines ;)
 
Yes I think he's not stating it very well. He wants to chat with me to explain it all but I think what he wants has already been implemented.
 
Well i am unfortunately not at all good when it comes to programming. But if i may explain it this way.

You as the member registers and buys a subscription on my forum.
1. You have an ID in your profile which is obviously stored on my forum/website server.
2. You pay R X.XX amount for a prescription which last 30days.
3 Everytime you login to the program or app the login page is enabled only if you have a valid subscription-- or else it will return "you are not subscribed"

My skype name is fastrack1696 if anybody thinks they could be of assistance id rather explain on a chat platform

thx all so far for the helpful comments

regards

Morgs
This just sounds like a standard subscription content web site, similar to e.g. an online newspaper subscription.
If that's the case you certainly don't need a mobile app, desktop app or even a web service.
 
Top
Sign up to the MyBroadband newsletter
X