473,410 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

query access database remotely?

Before I begin I want to apologise if my explanations are less than clear; that said, I'll try and be as detailed as possible.

Scenario:
User (XP OS, running office 2003) - IP = 1xx.x.x.101
phone system (linux OS, running 'trixbox') - IP = 1xx.x.x.222
phones (aastra 55i IP phones) - IP = 1xx.x.x.201

I want to be able to click a button on the customer record on our database on their computer, and have that customers number sent to the phone, so picking up the phone dials the number.
Still with me?

M'kay.
I have a php file that does what I want, IF I hard code the number and phones IP address into it. Obviously useless in the context I want it. (See bottom of post for code)

I know it's possible to send the info as a hyperlink such as http://1xx.x.x.222/callfromdb.php?number=01234567890&ipadd=1xx.x.x.20 1
(I think that's where I'd have to send it anyway. That's the link I have hard-coded into the phone (before the ?) which worked, but now for some reason doesn't.

This sounds like the most plausible method (from my extremely limited knowledge), so could someone help me modify the code for this method please?

I know about POST and GET, but the tutorials are confusing the heck outta me, and I think I've fried my brain.

callfromdb.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. #
  3. function push2phone($server,$phone,$data)
  4. {
  5. $xml = "xml=".$data;
  6. $post = "POST / HTTP/1.1\r\n";
  7. $post .= "Host: $phone\r\n";
  8. $post .= "Referer: $server\r\n";
  9. $post .= "Connection: Keep-Alive\r\n";
  10. $post .= "Content-Type: text/xml\r\n";
  11. $post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
  12. $fp = @fsockopen ( $phone, 80, $errno, $errstr, 5);
  13. if($fp)
  14. {
  15. fputs($fp, $post.$xml);
  16. flush();
  17. fclose($fp);
  18. }
  19. }
  20. ##############################
  21. $xml = "<AastraIPPhoneTextMenu>\n";
  22. $xml .= "<Title>Call Customer</Title>\n";
  23. $xml .= "<MenuItem>\n";
  24. $xml .= "<Prompt>Call Customer</Prompt>\n";
  25. $xml .= "<URI>Dial:01234567890</URI>\n";
  26. $xml .= "</MenuItem>\n";
  27. $xml .= "</AastraIPPhoneTextMenu>\n";
  28. push2phone("1xx.x.x.222","1xx.x.x.201" ,$xml);
  29. ?>
I can more-or-less understand the code; I just don't know where to begin rewriting it.
Expand|Select|Wrap|Line Numbers
  1. $_REQUEST['number']
apparently features somewhere; or possibly GET instead of request.

If you follow this and understand it, you're a genius and I thank you.
If you need clarification on something, please ask and I'll try my hardest not to make it worse.

Thank you all in advance for any help you can give.
Sep 17 '08 #1
6 2777
Atli
5,058 Expert 4TB
Hi.

So all you need, essentially, is to replace the hard-coded number and phone IP address with the values from the GET string?

You could simply do this at the top of the page:
Expand|Select|Wrap|Line Numbers
  1. $phoneNumber = $_GET['number'];
  2. $phoneIP = $_GET['ipaddr'];
  3.  
And the replace the hard coded lines with those variables.
Like say:
Expand|Select|Wrap|Line Numbers
  1. $data = "<URI>Dial: $phoneNumber</URI>";
  2. myFunction($phoneIP, $data);
  3.  
Sep 17 '08 #2
Expand|Select|Wrap|Line Numbers
  1. $phoneNumber = $_GET['number'];
  2. $phoneIP = $_GET['ipaddr'];
  3.  
Does it matter where in the code I put that?
Cos I've tried and nothing happens; I just get taken to a blank webpage.

Thanks
Sep 17 '08 #3
Hang on, it kinda works.

It seems to work intermittently.
I went to the page and it work; rang and everything.
Then I tried going again and nothing happened.

I think there must be some sort of delay or something, but I guess that's more phone related than something wrong with the php...

Thank you =)
Sep 17 '08 #4
Atli
5,058 Expert 4TB
The delay could be because of the Connection header you set there.
Try changing it from "Keep-Alive" to "Close".

That should tell the phone to close the connection immediately.
Sep 17 '08 #5
pbmods
5,821 Expert 4TB
Heya, mandanarchi.

Try removing the '@' in front of fsockopen() and looking at this article to see if anything untoward is going on.
Sep 18 '08 #6
Thanks both.

Once I'd added it to the VBA (using the 'follow hyperlink' method) all was fine.
My only snag is that it opens IE or FF (depending on default); but I know that's the normal behaviour of the method.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. #
  3. function push2phone($server,$phone,$data)
  4. {
  5. $phonenumber = $_REQUEST['number'];
  6. $phone = $_REQUEST['phone'];
  7.  
  8. $xml = "xml=".$data;
  9. $post = "POST / HTTP/1.1\r\n";
  10. $post .= "Host: $phone\r\n";
  11. $post .= "Referer: $server\r\n";
  12. $post .= "Connection: Keep-Alive\r\n";
  13. $post .= "Content-Type: text/xml\r\n";
  14. $post .= "Content-Length: ".strlen($xml)."\r\n\r\n";
  15. $fp = @fsockopen ( $phone, 80, $errno, $errstr, 5);
  16. if($fp)
  17.         {
  18.         fputs($fp, $post.$xml);
  19.         flush();
  20.         fclose($fp);
  21.         }
  22. }
  23. ##############################
  24.  
  25. $xml = "<AastraIPPhoneTextMenu>\n";
  26. $xml .= "<Title>Call Customer</Title>\n";
  27. $xml .= "<MenuItem>\n";
  28. $xml .= "<Prompt>Call Customer</Prompt>\n";
  29. $xml .= "<Dial>$phonenumber</Dial>\n";
  30. $xml .= "</MenuItem>\n";
  31. $xml .= "</AastraIPPhoneTextMenu>\n";
  32. push2phone("serverIP",$phone,$xml);
  33. ?>
That's my working code. I just follow the hyperlink to http://serverIP/callfromdb.php?phone=[phoneIP]&number=[number2dial] and it works.

Thank you =)
Sep 19 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bennett Haselton | last post by:
I want to get an ASP.Net hosting account with my ISP, and I'm trying to find out what level of access to the server is requried in order for me to view the server in Server Explorer in Visual...
4
by: Phil | last post by:
Hi all, I need some help to access an SQL db on another machine. I am using VB.NET and remoting to make a client/server connection...although I don't think this is relevant to the question. I...
4
by: C White | last post by:
Hi I am having problems with running a query that does the following there are 5 fields in a table that the query is based on, the first four are simple enough and all that happens is that the...
13
by: forbes | last post by:
Hi, I have a user that used the Query Wizard to create a query in Access. Now she claims that her master table is missing all the data that was excluded from the query. Can you create anything...
2
by: garth.waring | last post by:
Hi all I have seen the In Clause used to remotely query a text file done but cannot find the right syntax The example below is for an excel file : SELECT * FROM IN...
2
by: Cindy | last post by:
I have an Access 2003 database with a query that works fine on my PC but does not work on another PC. My PC has older versions of Access installed as well as 2003 - the other PC only has Access...
14
by: ApexData | last post by:
I am considering building some distributable commercial applications. For about a year now, I have been using Access2000. This was my first venture into object oriented database development. ...
0
by: boomertoo55 | last post by:
Trying to exec DTS task involving load of MS Access table to SQL Server 2000 table using Data Pump task via remote exec of xp_cmdshell command of dtsrun. That is, on client, connect to database...
3
by: Sonasang | last post by:
Hi , I am develping a web page with MYSQL as backend.... I have installed MYSQL and MYSQL connector to access the datas remotely... But i am getting the error when i try to access the...
1
by: jaceyk | last post by:
Is it even remotely possible to update field names to the correct field name for the same table using a data definition query? We have a utility that spits out data in an Access database for use in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.