FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » javascript, XmlHttpRequest, PHP, and daemon
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
javascript, XmlHttpRequest, PHP, and daemon [message #177236] Thu, 01 March 2012 13:15 Go to next message
SL is currently offline  SL
Messages: 20
Registered: February 2012
Karma: 0
Junior Member
Rather than banging my head, I think I shall ask the experts first.

From a web page, using javascript, there is no way to talk and listen to a
daemon on linux ( I gathered from folks here).

1. Using javascript I can send data to a PHP file and wait for it reply (aka
AJAX).

2. Assume that the PHP file is on the same server running the daemon.

Question
---------

Can I do this:

I send my data to a PHP file via XmlHttpRequest; the PHP file communicates
with the daemon and get its reply, after which the PHP will return the
result to my javascript ?

Thanks folks (forgive me if it is stupid).
Re: javascript, XmlHttpRequest, PHP, and daemon [message #177242 is a reply to message #177236] Thu, 01 March 2012 14:05 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
sl@exabyte wrote:
> Rather than banging my head, I think I shall ask the experts first.
>
> From a web page, using javascript, there is no way to talk and listen to a
> daemon on linux ( I gathered from folks here).
>

There is.

web sockets.

> 1. Using javascript I can send data to a PHP file and wait for it reply (aka
> AJAX).
>
yes.

> 2. Assume that the PHP file is on the same server running the daemon.
>
> Question
> ---------
>
> Can I do this:
>
> I send my data to a PHP file via XmlHttpRequest; the PHP file communicates
> with the daemon and get its reply, after which the PHP will return the
> result to my javascript ?
>
yes.

> Thanks folks (forgive me if it is stupid).
>
>


--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
Re: javascript, XmlHttpRequest, PHP, and daemon [message #177243 is a reply to message #177236] Thu, 01 March 2012 14:05 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/1/2012 8:15 AM, sl@exabyte wrote:
> Rather than banging my head, I think I shall ask the experts first.
>
> From a web page, using javascript, there is no way to talk and listen to a
> daemon on linux ( I gathered from folks here).
>
> 1. Using javascript I can send data to a PHP file and wait for it reply (aka
> AJAX).
>
> 2. Assume that the PHP file is on the same server running the daemon.
>
> Question
> ---------
>
> Can I do this:
>
> I send my data to a PHP file via XmlHttpRequest; the PHP file communicates
> with the daemon and get its reply, after which the PHP will return the
> result to my javascript ?
>
> Thanks folks (forgive me if it is stupid).
>
>

How is the PHP script going to communicate with the daemon?

Why are you beating your head against the wall trying to reinvent the wheel?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: javascript, XmlHttpRequest, PHP, and daemon [message #177246 is a reply to message #177242] Thu, 01 March 2012 14:28 Go to previous messageGo to next message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma: 0
Senior Member
On 3/1/2012 3:05 PM, The Natural Philosopher wrote:
> sl@exabyte wrote:
>> Rather than banging my head, I think I shall ask the experts first.
>>
>> From a web page, using javascript, there is no way to talk and listen
>> to a daemon on linux ( I gathered from folks here).
>>
>
> There is.
>
> web sockets.

Websocket?
Too early to advice that.

http://en.wikipedia.org/wiki/Web_socket#Browser_support

Maybe in a few years, but now is too early.
He can better implement the XHR approach if he wants it to work today. :-)

Regards,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
Re: javascript, XmlHttpRequest, PHP, and daemon [message #177249 is a reply to message #177243] Thu, 01 March 2012 16:09 Go to previous messageGo to next message
SL is currently offline  SL
Messages: 20
Registered: February 2012
Karma: 0
Junior Member
> How is the PHP script going to communicate with the daemon?

Using socket in PHP, localhost, port number which the daemon is listening.
Not possible on a web server ?

> Why are you beating your head against the wall trying to reinvent the
> wheel?

Just cross my mind whether this is a possibility. Possibly a poor man's
option.
Re: javascript, XmlHttpRequest, PHP, and daemon [message #177250 is a reply to message #177249] Thu, 01 March 2012 16:53 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 3/1/2012 11:09 AM, SL wrote:
>> How is the PHP script going to communicate with the daemon?
>
> Using socket in PHP, localhost, port number which the daemon is listening.
> Not possible on a web server ?
>

Why not?

>> Why are you beating your head against the wall trying to reinvent the
>> wheel?
>
> Just cross my mind whether this is a possibility. Possibly a poor man's
> option.
>
>

Why are you beating your head against the wall trying to reinvent the wheel?


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: javascript, XmlHttpRequest, PHP, and daemon [message #177251 is a reply to message #177246] Thu, 01 March 2012 16:55 Go to previous message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <4f4f8771$0$6973$e4fe514c(at)news2(dot)news(dot)xs4all(dot)nl>,
Erwin Moller <erwinmollerusenet(at)xs4all(dot)nl> wrote:

> On 3/1/2012 3:05 PM, The Natural Philosopher wrote:
>> sl@exabyte wrote:
>>> Rather than banging my head, I think I shall ask the experts first.
>>>
>>> From a web page, using javascript, there is no way to talk and listen
>>> to a daemon on linux ( I gathered from folks here).
>>>
>>
>> There is.
>>
>> web sockets.
>
> Websocket?
> Too early to advice that.

Too early to advise that? Perhaps. But its as well to be aware of it.
Recent browsers all support it, whether they support the recently
completed RFC exactly is another matter.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Tutorials for PHP Beginners
Next Topic: MAX(id)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 01:08:24 GMT 2024

Total time taken to generate the page: 0.02370 seconds