Re: [PHP] Returning a recordset to a desktop app

2011-03-09 Thread Ken Watkins

On 3/7/2011 7:19 AM, Richard Quadling wrote:
 On 5 March 2011 13:48, Ken Watkins k...@atlanticbb.net wrote:
 On 3/5/2011 4:30 AM, Richard Quadling wrote:
 On 4 March 2011 23:48, Ken Watkins k...@atlanticbb.net wrote:
 Hi All.

 I have a Windows desktop app that I created using Visual Foxpro (a 
 database app).
 I want to write a PHP script that I will call from my desktop app. The 
 script will simply
 query a MySQL database on my web server and return the recordset to the 
 desktop app.

 My question is simply this: What is the preferred method for passing this 
 recordset back
 to the desktop app? I'm assuming that there's no reasonable way to send a 
 recordset back
 without converting it to an array or XML or an object or something? How do 
 I return the
 data in the recordset to the desktop app?

 Thanks for your advice.
 Ken Watkins
 In general terms, the output of a PHP script is going to be text
 (html, xml, csv, etc.) or binary (images).

 Getting a PHP script to communicate natively with FoxPro is not going
 to be trivial task. It MAY be able to be done, but hopefully FoxPro
 has the capability of running a PHP script via the command line ...

 C:\PHP5\php.exe -f script.php -- script_arg1 script_arg2

 PHP can either output the result set (in an appropriate form) directly
 and FoxPro could read it from STDIN (if it has that support) or PHP
 can write the answer to a file and FoxPro can use normal file and
 string functions to read the data.

 If FoxPro has XML support, then use it. It will be much cleaner in the
 long run if the data changes. If not, then a tab separated data file
 (rather than a CSV file). This assumes that your data does not contain
 tabs. If so, choose another separator.

 Richard.
 Richard,

 Foxpro does have XML support, so you answered that part of my question, 
 thanks.
 And it is capable of calling any other executable on the local machine 
 through the
 local OS shell - which seems to be what you are advocating. But I'm not sure 
 how
 I would do that over the internet. I just discussed this issue with Larry, 
 and I assume
 that I would use HTTP? Or is there a way to call a command line script on a 
 remote
 web server without using HTTP?  Sorry if this is a stupid question.

 Thanks for your help!
 Ken
 So, what you need to have is an HTTP Request from within FoxPro.

 http://www.example-code.com/foxpro/http_post_form.asp

 gives an example, but it seems to use a third party ActiveX component.

 If FoxPro can load any locally resident/installed ActiveX component,
 then maybe ...

 http://fox.wikis.com/wc.dll?Wiki~ReadUrl

 has better examples.


 So, using something from that to get the data (XML) and then using
 FoxPro's native support for XML and you should be on your way.

 But at this stage, I'd be looking to ask for further help in a FoxPro
 forum as this is really nothing to do with PHP.

 Good luck.

 Richard.
Richard,

Thanks for your comments. I ended up taking the simple approach - I installed 
an ODBC driver for MySQL and let Foxpro query the database directly from a 
remote workstation. I suppose that what I wanted to do originally was to 
introduce PHP into the mix just to have another option, and to gain more 
experience in PHP. Probably not a good idea anyway.

Thanks again for the help.
Ken Watkins

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Returning a recordset to a desktop app

2011-03-05 Thread Ken Watkins
Larry,

Yes, the PHP script will reside on my web server along with the MySQL database.
I assumed that I would call the script over HTTP, but I guess that is part of 
my question too.
Foxpro allows you to embed controls in its forms, and one of them is a browser 
control. But
I don't really want to echo anything to the enduser, I just want to capture the 
data behind
the scenes, so to speak. I think I can handle that with the browser control.

If I understand you correctly, when I do an echo statement or a print statement 
(or a return()?),
it will return the data to the desktop app. And the best way to return it is in 
xml. I'll investigate
the methods you mention for converting xml since I'm not familiar with any of 
them.

Thanks!
Ken


On 3/4/2011 6:51 PM, la...@garfieldtech.com wrote:
 Assuming you mean that the PHP script is on a web server somewhere and the 
 desktop app is hitting it over HTTP, it's no different than any other 
 response.  Anything you print will be sent back to the client, in this case 
 your desktop a..  So if you want to send XML back, you'd build a string with 
 your XML (either manually or using the DOM or SimpleXML APIs or a 3rd party 
 like QueryPath or whatever floats your boat) and print it, just as you would 
 HTML.

 Note that you may need to explicitly set headers with header() to make sure 
 the desktop app reads it properly.

 --Larry Garfield

 On 3/4/11 5:48 PM, Ken Watkins wrote:
 Hi All.

 I have a Windows desktop app that I created using Visual Foxpro (a database 
 app).
 I want to write a PHP script that I will call from my desktop app. The 
 script will simply
 query a MySQL database on my web server and return the recordset to the 
 desktop app.

 My question is simply this: What is the preferred method for passing this 
 recordset back
 to the desktop app? I'm assuming that there's no reasonable way to send a 
 recordset back
 without converting it to an array or XML or an object or something? How do I 
 return the
 data in the recordset to the desktop app?

 Thanks for your advice.
 Ken Watkins

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Returning a recordset to a desktop app

2011-03-05 Thread Ken Watkins
On 3/5/2011 4:30 AM, Richard Quadling wrote:
 On 4 March 2011 23:48, Ken Watkins k...@atlanticbb.net wrote:
 Hi All.

 I have a Windows desktop app that I created using Visual Foxpro (a database 
 app).
 I want to write a PHP script that I will call from my desktop app. The 
 script will simply
 query a MySQL database on my web server and return the recordset to the 
 desktop app.

 My question is simply this: What is the preferred method for passing this 
 recordset back
 to the desktop app? I'm assuming that there's no reasonable way to send a 
 recordset back
 without converting it to an array or XML or an object or something? How do I 
 return the
 data in the recordset to the desktop app?

 Thanks for your advice.
 Ken Watkins
 In general terms, the output of a PHP script is going to be text
 (html, xml, csv, etc.) or binary (images).

 Getting a PHP script to communicate natively with FoxPro is not going
 to be trivial task. It MAY be able to be done, but hopefully FoxPro
 has the capability of running a PHP script via the command line ...

 C:\PHP5\php.exe -f script.php -- script_arg1 script_arg2

 PHP can either output the result set (in an appropriate form) directly
 and FoxPro could read it from STDIN (if it has that support) or PHP
 can write the answer to a file and FoxPro can use normal file and
 string functions to read the data.

 If FoxPro has XML support, then use it. It will be much cleaner in the
 long run if the data changes. If not, then a tab separated data file
 (rather than a CSV file). This assumes that your data does not contain
 tabs. If so, choose another separator.

 Richard.
Richard,

Foxpro does have XML support, so you answered that part of my question, thanks.
And it is capable of calling any other executable on the local machine through 
the
local OS shell - which seems to be what you are advocating. But I'm not sure how
I would do that over the internet. I just discussed this issue with Larry, and 
I assume
that I would use HTTP? Or is there a way to call a command line script on a 
remote
web server without using HTTP?  Sorry if this is a stupid question.

Thanks for your help!
Ken

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Returning a recordset to a desktop app

2011-03-04 Thread Ken Watkins
Hi All.

I have a Windows desktop app that I created using Visual Foxpro (a database 
app).
I want to write a PHP script that I will call from my desktop app. The script 
will simply
query a MySQL database on my web server and return the recordset to the desktop 
app.

My question is simply this: What is the preferred method for passing this 
recordset back
to the desktop app? I'm assuming that there's no reasonable way to send a 
recordset back
without converting it to an array or XML or an object or something? How do I 
return the
data in the recordset to the desktop app?

Thanks for your advice.
Ken Watkins


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multiple cookies on the same computer

2009-03-31 Thread Ken Watkins
 On 3/27/2009 at 8:10 PM, in message 49cd6b07.6010...@mac.com, Michael A. 
 Peters mpet...@mac.com wrote:
Ken Watkins wrote:
 I have set up a blog site where my family creates posts and they get emailed 
 to members of the family. To keep up with their identities, I created a 
 script for each family member to run (dad.php, mom.php, etc.), and it sets a 
 cookie on each computer and uses sessions so I know who is connecting. It 
 works great unless I want to share a computer between two users.
 
 I thought I had a solution: install both Firefox and IE on the same computer 
 and set two different cookies. But this doesn't seem to work. My question 
 is: Is it possible to set one cookie for IE and another for Firefox so that, 
 depending on which browser is used, I can tell who is connecting to the 
 blog? If this is not possible, is there another easy way to do it?
 
 Thanks for your help.
 
 - Ken Watkins
 

Why not just use session cookies that expire as soon as a session is 
over (browser quits) and use a login?

Hi Michael.

Thanks for the suggestion. I'm trying to keep it as simple as possible with as 
few keystrokes (for the user) as possible, but your suggestion may be the best 
way to go.

Thanks!

Ken Watkins 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multiple cookies on the same computer

2009-03-27 Thread Ken Watkins
 On 3/26/2009 at 11:12 PM, in message 70.12.30978.2144c...@pb1.pair.com, 
 Shawn McKenzie nos...@mckenzies.net wrote:
Shawn McKenzie wrote:
 Ken Watkins wrote:
 Hi all.

 Newbie here.

 I have set up a blog site where my family creates posts and they get emailed 
 to members of the family. To keep up with their identities, I created a 
 script for each family member to run (dad.php, mom.php, etc.), and it sets a 
 cookie on each computer and uses sessions so I know who is connecting. It 
 works great unless I want to share a computer between two users.

 I thought I had a solution: install both Firefox and IE on the same computer 
 and set two different cookies. But this doesn't seem to work. My question 
 is: Is it possible to set one cookie for IE and another for Firefox so that, 
 depending on which browser is used, I can tell who is connecting to the 
 blog? If this is not possible, is there another easy way to do it?

 Thanks for your help.

 - Ken Watkins


 
 Even if you don't need it secure, have a login.  Dad and mom can login
 with dad or mom with no password if all you need to do is give them
 their own cookie/session.
 
 

Optionally, I just thought that if this was too much for them to
do/remember, they could have their own bookmarks, like Dad - Yoursite
(http://www.yoursite.com/index.php?person=dad) and Mom - Yoursite
(http://www.yoursite.com/index.php?person=mom) and set the
session/cookie or whatever you're doing based on $_GET['person'].

I would still opt for the login though, even if not secure.

-- 
Thanks!
-Shawn
http://www.spidean.com 

 
Hi Shawn -

I was hoping to avoid logging in every time, but that may be the best way.
What I still don't understand is:  I thought that Firefox and IE each had their 
own cookies, and that I could determine the user by which browser they used. In 
other words, Firefox's cookie would be for dad and IE's for mom. But I can't 
figure out how to do that. Do Firefox and IE share cookies?

Thanks.
Ken


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multiple cookies on the same computer

2009-03-27 Thread Ken Watkins
 On 3/26/2009 at 10:24 PM, in message 
 0a88dc6e-0655-4565-b9a7-e21337fc0...@bluerodeo.com, dg 
 dane...@bluerodeo.com wrote:

On Mar 26, 2009, at 7:14 PM, Ken Watkins wrote:

 To keep up with their identities, I created a script for each family  
 member to run (dad.php, mom.php, etc.), and it sets a cookie on each  
 computer and uses sessions so I know who is connecting.

Each family member only uses her/his own page?  Maybe set a unique  
cookie name based on each page?

Hi.

No, they all go to a common page. I may have to take Shawn's suggestion and 
just have them login if I can't figure another way to do it.

Thanks.
Ken




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Multiple cookies on the same computer

2009-03-27 Thread Ken Watkins
 On 3/27/2009 at 10:19 AM, in message 6f.57.30978.d60ec...@pb1.pair.com, 
 Shawn McKenzie nos...@mckenzies.net wrote:
 Optionally, I just thought that if this was too much for them to
 do/remember, they could have their own bookmarks, like Dad - Yoursite
 (http://www.yoursite.com/index.php?person=dad) and Mom - Yoursite
 (http://www.yoursite.com/index.php?person=mom) and set the
 session/cookie or whatever you're doing based on $_GET['person'].
 
 I would still opt for the login though, even if not secure.
 

No, they use their own cookies so if you want to do it that way, use:
$_SERVER['HTTP_USER_AGENT'] and set the cookie based upon the browser.

Another thought I had was if you can add domain aliases,
dad.yoursite.com and mom.yoursite.com, then they will each have
different cookies.
 
Shawn -
 
Yes, domain aliases sound good too. OK, you've given me a couple of good 
suggestions, and one of them should suit me :)
Thanks much.
 
Ken

 


Re: [PHP] Multiple cookies on the same computer

2009-03-27 Thread Ken Watkins
 On 3/27/2009 at 11:15 AM, in message 
 1238166938.3522.5.ca...@localhost.localdomain, Ashley Sheridan 
 a...@ashleysheridan.co.uk wrote:
On Fri, 2009-03-27 at 09:59 -0400, Ken Watkins wrote:
  On 3/26/2009 at 10:24 PM, in message 
  0a88dc6e-0655-4565-b9a7-e21337fc0...@bluerodeo.com, dg 
  dane...@bluerodeo.com wrote:
 
 On Mar 26, 2009, at 7:14 PM, Ken Watkins wrote:
 
  To keep up with their identities, I created a script for each family  
  member to run (dad.php, mom.php, etc.), and it sets a cookie on each  
  computer and uses sessions so I know who is connecting.
 
 Each family member only uses her/his own page?  Maybe set a unique  
 cookie name based on each page?
 
 Hi.
 
 No, they all go to a common page. I may have to take Shawn's suggestion and 
 just have them login if I can't figure another way to do it.
 
 Thanks.
 Ken
 
 
 
 
You could have a landing page to the site, that consists of image links
(you could use their photo for this?) and each link is in the order of
page.php?person=mum etc. That would require an extra click, but no
typing for a login, and should make the unique person process a bit more
intuitive.


Ash
www.ashleysheridan.co.uk 
 
Hi Ash.
 
Hey, I like it. Clicking beats typing in my book. Thanks!
 
Ken


[PHP] Multiple cookies on the same computer

2009-03-26 Thread Ken Watkins
Hi all.

Newbie here.

I have set up a blog site where my family creates posts and they get emailed to 
members of the family. To keep up with their identities, I created a script for 
each family member to run (dad.php, mom.php, etc.), and it sets a cookie on 
each computer and uses sessions so I know who is connecting. It works great 
unless I want to share a computer between two users.

I thought I had a solution: install both Firefox and IE on the same computer 
and set two different cookies. But this doesn't seem to work. My question is: 
Is it possible to set one cookie for IE and another for Firefox so that, 
depending on which browser is used, I can tell who is connecting to the blog? 
If this is not possible, is there another easy way to do it?

Thanks for your help.

- Ken Watkins




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php