I'm working on a project that is located on 2 domains within same server:
1. DataSource system, which provides data for main app
2. Main app, providing the data for front-end app.
App 1 needs to work on seperate domain, as it's data source for more applications. I'm trying to find some way to boost communication performance. Simple call from app 2 to app 1 takes approximately 0.3-0.4s.
Is there anyway to force server to bypass TCP/IP communication and call service directly from localhost?
Both applications are written in PHP with Zend Framework. The server is IIS. Both applications are based on SOAP solutions.
Would appreciate any tips. Will provide additional information if needed.
Thank you in advance for any help.
You have a misunderstanding here. If you call services from localhost (i.e. via Zend_HTTP_Client), this means you are using the tcp/ip and http layers here. Everything works via sockets, no matter if localhost or external ip address.
If the other application needs to be accessible "from the outside" (no integration possible) you can imho only speed up by using a faster webserver (e.g. nginx), turning off modules in your webserver that you don't need or writing your own socket server, dismissing a whole lot of the processing apache and nginx do. http://devzone.zend.com/209/writing-socket-servers-in-php may help you with your first steps.
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 :)
What is the best way to communicate between a shared hosted PHP site (on GoDaddy) and a Windows service on computer at another site? I would like to build a site that will allow a customer to schedule tasks on their server, and then look at logs of those tasks that have run. The problem is getting the scheduling information from the web site to the server, and then pulling log information from the server back to my web site. I will have access to the server to install a service (not sure what language would be best to build the service).
I’ve thought of two options. I wonder if either of these two options makes sense or if a third option would be better.
Option 1 - Sockets:
My PHP code would use fsockopen and fputs
My Windows service would open a socket and receive the text.
The problem I see is potential firewall difficulties. Also, the two would have to open sockets at the same time.
Option 2 – FTP:
The windows service would periodically (once a minute or so) open an FTP connection to my GoDaddy site and place a file and also check to see if there is a file to pull down.
Any thoughts would be appreciated.
Thanks.
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'm trying to learn about node.js and there are tons of examples out there, but one question that I can't find an answer to or example is how does this work with web hosts (i'm using inmotionhosting.com)?
say I have a basic website www.url.com/index.php (note: I'm using PHP also). For this website to work, all I have to do is upload a file into my file manager in my web hosting site.
How does node.js work? do I just upload a node.js file into the web hosting also?
In all the examples, they are using localhost with port 8000 or something. Can someone shine some light?
Thanks!
you will need at least VPS hosting to install node.js, shared hosting won't allow you to install any application on your own, unless you they give you the option to do it.
then it all depends on how you have configured and what application is node.js serving, you can't really say where to upload files by default unless a path is set either from you or from webhosting..
from nodejs.org
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
it doesn't say it specific for web use, instead you should use a web framework such as
ExpressJS where you can build you web application or any other stuff.. your host should provide further information on how to manage packages in your nodejs instance, configuration, etc..
some usefull links
Domain API
ExpressJS
ExpressJS examples
Here is something i came cross.
Hosting your node app?
Hosting Node Apps
nodeFu
Supported hosting providers?
Node Hosting
just read the descriptions for each section.
I will be developing an application for a club where they will have visitors use biometric systems(finger print) or magnetic cards to mark their attendance.
This application is planned as a web app, made using PHP/MySQL/Javascript. It does a lot of other things as well.
What I wanted to find out is how is the interface between Biometric/Megnetic Card systems to a web app done?
I've never worked on this and am hoping if someone who has experience with this can throw some light on this as to how this could be accomplished. Any pointers will be appreciated.
Also, we will be hosting this application remotely. So we won't have physical access to the web-server.
(I'm afraid there's got to be some form of application installed on a pc that would interface with the hardware and probably makes calls to the web app. But, if there was a way to connect it to the web app directly, then the app would be easy to deploy to any location with minimal installation.)
Thanks! :)
How is the hardware connected? Directly to the app server, or to a standalone box of some sort? If it's a standalone box, then yes you'll have to have some kind of program on the box collect the data and send it to the web app. If it's connected directly to the app server, then you need to write something that either polls the hardware or receives messages/events from the driver and DTRT wrt the web app.
There three type of communication channels are supported by the biometric machines. They are serial, TCP/IP and HTTP. In your case, you either need to implement TCP/IP or HTTP.
If your application is running the intranet, then you can implement the TCP/IP server application and host at a intranet system which is expected to write in a common database between the biometric application and your web-app.
If your application is hosted at the server, then you can implement the http server and associated the URL with the machine. For this you need buy the http api supported machines. Here is the google search link for finding such machines.