Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote query push/flush - How does one allow query from remote servers?

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
I think I wrote something to this respect a very long time ago and I now find myself with a blank stare.

The project:
I have my PHP server where people come into to do their daily operations and data entry. Now, we have the need to allow people to, manually or automated, send a query to my server (think of it as a fetch) and receive in turn the data or information pertaining to their query.

I want to think of it as a form being submitted at a remote site, my server will validate origin and once valid, process query and send back the results.

I also need to write the code that makes the query request and need to process the received data segment.

Running in LINUX servers, so may be able to put up a `cron` to do this if automated or provide users with a command (shell script) that would do it on demand.


The problem:
I figure that the receiving server (where the query is sent to), the code is pretty simple, just like processing any other query with a GET/POST method.

The originating server seems to me a bit more of a challenge. I am not sure if I should use PHP as a scripting language (and I am very tempted to) or should I use something else. I have never used PHP as a scripting language but feel as if it would be ideal for this (PHP to PHP, what could go wrong?).

My biggest problem is that I feel as if I lack direction on this and so I am reaching out to you guys, perhaps, it is so simple and obvious that I am over complicating things.

Thank you all in advance for your assistance!



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
php _is_ a scripting language. so feel free to use that and know that it is an excellent tool.
to 'send' the data to the server from the client use file_get_contents (with an http protocol prefix) or use curl. the former does not support POST operations.
 
Just reading a paper on using PHP CURL to query remote servers ... :)

Thanks for the suggestions, truly appreciated!!!

--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Maybe I misunderstood, but it seems you may want to look into creating a webservice with PHP

This would allow a remote PHP page to connect to your script and use certain functions you provide to access things and maybe submit queries and get data back.


Basically its an access point to series of methods or functions that can then use your server and do things.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
vacunita, you did understand my original post ... except about the part of the use of "methods or functions" ... Queries will likely be done via a cron scripts or same scripts called on demand via user interface or command line.



--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
No need for crons jobs with a webservice.

The Queries can be pre-programmed, and all the users would have to do is call the method that runs a specific query.

So if you have a query1 that reads the Db and returns data based on x or y parameters, you can set that up in a method that your users can access on demand.

That's what a webservice does.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top