I saw a question similar however the answers were irelevant to what I'm trying to achieve. Given that I have a local media server (for example Wowza) how can I use another server to pipe the requests to my local wowza server?
I'll expand. Given I have an application which sends live video feed to a webserver which runs apache server I'm looking for a script (prefebly php) to recieve this data and send it to another server which has wowza. (so basically act like a proxy)
ADVANCED:
I was also looking for a little more advanced solution if possible. If I open the webserver (send a request) I want it to start sending data to my local wowza server given it knows the right port
Related
I need to create an application using php which is hosted in a server and need to communicate with a csv file located in clients local machine. Is there any way we could do this ? How can I connect to a remote csv file ? Is this possible ?
Server machine accessing a csv file directly from a client machine is not a good idea. It's a security threat indeed. Consider you are navigating some website and it's server is able to access your computer's file system!!!
There are various alternatives to achieve this, some of these might be:
Make the user upload csv files to server in order to make it
available to the server application
If the client and server are in the same network, then share the
folder on client machine to make it accessible from the server
etc... I would have preferred the first option as mentioned above.
As #AnthonyB mentioned in comment under your question, server can't directly call client, and that is true. Server is called "server" as it serves requests from the client.
To be able to give away files to remote requests, your client needs its own server application, like Apache HTTPD for example.
In case if you need continuously request client's server to collect files with your PHP server, what you are looking for called "worker". One of AWS tools called Elastic Beanstalk offers possibility to choose a server or a worker application during start up wizard for PHP. It is pretty straight forward and easy to use.
Please note, that your client must have dedicated IP address or use Dynamic DNS approach by pushing its IP to a DB (or directly to a server) where worker will take it from.
If you don't need dedicated worker, you can configure CRON JOB to send requests to clients server applications.
IMHO, all that scenario worth it only if you are building corporate grade application. In most cases (and if you do REALLY need to collect files from clients) you have to install Apache + PHP server on the client side and make this guys to wait for request from YOUR remote php server. Without it, you can not get files from clients computers via browser without user input interactions. At least legally :)
I am trying to develop a socket.io application. It is just a simple application like the one on the Getting Started - Chat application tutorial in the Socket.IO webpage. But the problem is that, I do not want to have the socket.io server serve the client automatically, because I am planning to have a page (in PHP) have a script that can simultaneously be updated by data from a server in real-time using Socket.IO. I just want a certain client that can connect to the server and let them communicate, not a page served by the socket.io server.
Is this possible? Can you please give an idea on how can it be done. Thanks.
That chat tutorial is just a simple deployment where your own web page wants to connect back to the same server that the web page came from. That is not the only way to do it.
The socket.io client code can be served from anywhere. You can even link to a CDN and get it from there instead of from your own server.
And, likewise, the client can connect to any compatible server as long as the server is configured to accept a connection from your page.
If you're looking for how to connect to a different server, you just specify the URL of the desired host in io.connect() like this:
var socket = io.connect('http://www.example.com');
I want to send a file from my browser to a server which is not the server on which the site is hosted.The problem is the another server is not a web server.
Is it programmatically possible to send a file to different server without the involvement of host server? I do not want copy of the file I am uploading on my hosting server.
Sorry for not being clear on the first go. I hope this makes sense.
Note: I have the IP address of server. Implementation has to be done in a secure way.
Create a signed application to handle the upload.
One of the fundamental rules of browser sandboxing is that you don't let the browser communicate to a server other than the one which provided the website. This has been a rule for quite some time, and is done for security reasons.
The only way I know of to bypass this restriction is to use a signed application. This is possible in several languages including at least Flash and Java. Once you've signed your application with an authoritative source, then you can specify that your application is known to communicate with a third-party server and should be trusted to do so. The process of doing this will be different depending on the technology you choose.
The server to which you are sending the file needs to allow some sort of protocol in order to accept the file. You do not specify what that is, but these languages should be more than sufficient to implement whatever you need.
given that you have the necessary authentication of the secondary server you can
i'll explain using ftp, but there can be other socket related ways
1) upload the file to your server as usual, using $_FILE
2) use the ftp class in php to transfer the file to the remote host
Thanks all for valuable suggestions. I am opting for bit weird way but it seems the only feasible solution considering the current requirements of the project.
I am planning to install lite version of web server and php on the external server which can accept uploaded files through browser.
Our team has worked out this is the best solution we can consider as of now.
Thanks again to all for their suggestions.
This is done all the time with Firefox plugins, (youtube etc.). Does it have to be driven from your page source ? How stealthily do you want to do this ?
The other server should use a common protocol, SSH or ftp or NFS or CIFS.
In any case the user is going to have to agree with the plugin or the applet or a third party service (think punkbuster) running in the background.
BF4 runs in a browser window via a plugin and routinely sends data to servers other than the game server.
I have a Ubuntu Server on which I have my Apache and FTP server (I am using Proftpd server). I have a small PHP CMS and for database I am using MySQL server. This was my server side environment. Now on client side I have a C# ftp client which I use to download the file from FTP server. Also, this C# client communicates with my PHP CMS.
So in short there are two communications occurs at a time
1. C# client and FTP server for file transfer.
2. C# client and PHP CMS for some other work.
So, now what I want is real time progress (progress bar) of my ftp transfer on one of my CMS webpage.
Obviously one of thing I can do is that I can tell my C# client to upload it's download progress to PHP server using some web service or web socket and then I can show the progress of ftp transfer(basically progress of downloading of C# client).
But before doing this I just want to know that is it possible for my PHP server to check what FTP server is doing. Since, no communication occurs between them I don't know how to accomplish it? I have a MySQL server and I know that proftp can communicate with MySQL server and it has some predefined table in which I can store whatever is ftp server doing. But will it possible to use it to show a real time progress? Is their any other technique to do this or will I have to force my C# client to do it?
From what you say, you have no need to talk to the FTP server at all (except to download the file, of course). Your FTP client could upload the FTP transfer status to a Web socket (and why could it not display it directly?), there to be recovered by the CMS and shown in the page. By using sessions, you do not even need to actively save that information anywhere, provided the Web socket call properly initializes the session cookies.
In the FTP client download callback function just add a call to send the progress status to the server. There, a scriptlet will save it into, say, $_SESSION['download_status']. An AJAX call on the CMS page can then retrieve it and display it periodically.
Don't forget to also upload FTP session and exception status (transfer interrupted, etc.).
I want to control a robot from the web, the robot is connected to Android device. The operation will be as the following :
a web application written using JavaScript and HTML runs on desktop computer which takes the keyboard input from the user and send them to the android device connected to the robot.
the android device receive the commands and then send them to Arduino board which used to control the robot.
But how should I deliver the data to the Android device which doesn't has a static IP address?
I have two approaches to solve that :
the JavaScript application sends the keyboard input to a web server runs PHP and MySQL , then the php application store the data on the MySQL database. An application runs on Android connected to that web server and extract the data from the MySQL database.
the JavaScript sends the data to the web server. The android application connected to the web server receives the data directly so the web server is just used as a relay.
The first approach is easy to do but its slow , so my question is...
How to implement the second approach and which web technologies should I use to implement it? And how to make the web server works as relay between two sides?
PS : I am planning to use 000webhost.com as web server. so I will not use my own server
You can either have your Android application poll the webserver for outstanding commands. This is a little inefficient in terms of data usage, but if you're on an unlimited 3G plan / wi-fi, you could live with it. It will be very easy to implement.
Alternatively, set up a TCP server on your server, and have your Android application open a socket connection with the server. This way, your web application can send commands to the server which will immediately stream them to the Android device. It will be slightly harder to implement, but will be more efficient and robust if done right.
PS - Most shared servers don't allow you to open a TCP server on your host so you might be forced to go with the first option.
PPS - I wasn't aware of Google Cloud Messaging. It seems to be a good solution for you what you're attempting to achieve. You should have a look into it.