3

Hey
Any good resources for writing openvpn client in PHP?
I tried Googling but couldn't find any good article in layman's terms

Thanks

Comments
  • 3
    Sounds like something that another language would be much more suited to. Like lua. What are you trying to do?
  • 0
    @ScriptCoded client needs it in php
  • 4
    I don't think you'll find something in laymans terms because vpns are complex as fuck
  • 2
    @Ganofins but... why?
  • 1
    @Jifuna i should've said no to him. I tried going through openvpn client code and other open-source openvpn client codes but couldn't understand any of it

    @tosensei client needs it
  • 5
    @Ganofins but... WHY does the client need it?

    correction: why does the client THINK they need it?
  • 1
    @tosensei he just needs to pass some random collected openvpn configs to the script and print only the working openvpn configs
  • 0
    @Ganofins Oh so its a config checker? Or does it also need to check connections?
  • 6
    @Ganofins so he doesn't need an openvpn client in php.

    you could just use php to invoke console commands to feed the files into an already-existing native openvpn-client.
  • 1
    @tosensei Exactly this
  • 0
    @tosensei @Jifuna I tried that the very first but didn't work since after invoking the openvpn on console, like if it is connected the shell_exec function will never stop
  • 0
    @tosensei @Jifuna like openvpn command doesn't simply return true or false if the openvpn config file is connectable or not
  • 1
    @Ganofins Yeah I think you should say no to the client. One way to do it is reading the output from the openvpn but I'm not sure if that's possible in php with the command still running? You also have openvpn verify command but I don't think that's what you need.
  • 0
    @Jifuna I think openvpn --status will do the job
  • 1
    @Ganofins Ah if you can make the command run async, while reading that file in an interval that should work.
  • 5
    I have done things in PHP that would turn some eyes, but this.... yeah, nah this ain't one of them.

    Why, of all the languages better suited for this, would you use PHP?
    This ain't a PHP hate thing, I love my php 🥰
  • 0
    @C0D4 it's just that client needs it in php
  • 1
    Thanks everyone for your valuable responses
    I think openvpn --status trick worked. Waiting for the client's response
Add Comment