[PHP] Breaking out of a loop...

2004-05-12 Thread René Fournier
Hi, I have this code (below) that waits for particular data to come over the socket (ENX), at which point it breaks out of the loop and does other things. Presently, it will loop forever, until it receives ENXa good startbut I also need it to break-out if the loop runs longer than five

Re: [PHP] Breaking out of a loop...

2004-05-12 Thread René Fournier
Thanks for the help, but I now get the error PHP Warning: socket_set_option() expects exactly 4 parameters, 3 given in /Users/test/cr.php on line 51 when I run the script. Also, it still seems to just wait on that while line, instead of skipping to the } elseif ($elapsed 5) { and

[PHP] Socket looping challenge

2004-05-13 Thread René Fournier
Hi all, Still encountering some challenges with my socket loop. Basically, I need this socket client to wait to read incoming data, but if nothing happens for more than three seconds, I want it to do something, then return to waiting (for another three seconds). I've got some good help

[PHP] Why would a socket be unavailable?

2004-05-13 Thread René Fournier
I get this output: PHP Warning: socket_read() unable to read from socket [35]: Resource temporarily unavailable in /Users/rene/Sites/gpspolice/titan/cr.php on line 63 From this code: do { socket_set_block($socket); socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,$timeout);

Re: [PHP] Socket looping challenge

2004-05-13 Thread René Fournier
The script doesn't even get that first while condition line. It loops a few times (while receiving messages), then when no more messages are coming from the server, and it times-out, it breaks out of the while, then returns to the top again, where it that while condition returns the error

Re: [PHP] Why would a socket be unavailable?

2004-05-13 Thread René Fournier
There is no firewall. I'm running this locally. On Thursday, May 13, 2004, at 05:00 PM, raditha dissanayake wrote: #1 cause for socket failures happen to be firewalls. René Fournier wrote: I get this output: PHP Warning: socket_read() unable to read from socket [35]: Resource temporarily

Re: [PHP] Why would a socket be unavailable?

2004-05-13 Thread René Fournier
On Thursday, May 13, 2004, at 05:13 PM, Daniel Clark wrote: http://www.php.net/manual/en/ref.sockets.ph Yes, I've read that page... many times. It has not helped me. That is why I am posting my problem here, in that hopes that someone can help. (I don't mean to be completely helpless, but I

Re: [PHP] Why would a socket be unavailable?

2004-05-13 Thread René Fournier
There is no firewallit's all running locally, on my iBook (with Firewall off). You know, I really wish it WAS the firewall. :-) I really can't believe this little problem I'm encountering is because of some bug in the Socket library. I mean, what I'm doing is so simple, and I'm sure hundreds of

Re: [PHP] Why would a socket be unavailable?

2004-05-13 Thread René Fournier
Hi Warren, There is only one process, and I'm sure I have only one IP address. It's just one script that loops. At the top of the loop, it waits to socket_read some data. If no data appears, I want it to timeout so that it can send the server a ping (which I must do). THAT is where the

[PHP] To pack(), or not to pack()

2004-05-10 Thread René Fournier
Hi, I'm developing a PHP program that must send data, over a socket connection, to a server. The server requires the data in a particular format, e.g.: FORMAT: 3-byte delimiter - Message Length (N = 4 bytes) - Message Type (4 bytes) - Message Body (N - 4 bytes) - 3-byte Delimiter SAMPLE

[PHP] unsigned long int

2004-05-10 Thread René Fournier
I don't know C, but I was wondering if it is possible to: 1. Define 32-bit integer in PHP, called $val (max value of $val); 2. Assign the value of 10 to $val. 3. Pack $val to a binary variable ($bin_var); ...such that $val is only equal to 10, but it is occupying 32-bits of data... (In case you

[PHP] Binary to ASCII

2004-05-10 Thread René Fournier
When reading from a Socket Server, my Socket Client retrieves data that includes ASCII and binary data: while(($buf = socket_read($socket,128,PHP_BINARY_READ)) !== false) { $data .= $buf; if(preg_match(/ENX/, $data)) break; } echo RESPONSE: .$data.\n; The output looks

Re: [PHP] Why would a socket be unavailable?

2004-05-14 Thread René Fournier
that as this thread has grown, the original issue is no longer clear.) Thanks guys for helping. ...rene Warren Vail -Original Message- From: René Fournier [mailto:[EMAIL PROTECTED] Sent: Thursday, May 13, 2004 5:13 PM To: Vail, Warren Cc: php Subject: Re: [PHP] Why would a socket

[PHP] Socket client can do one thing (loop), but not the other (loop, timeout, loop again)

2004-05-14 Thread René Fournier
Hello everyone, I really appreciate the suggestions so far with my socket client problem. Somebody suggested I repost the issue with the program flow and code, to clarify the situation (a good idea). So here it is: To sumarrize: My socket client runs fine when all it does is (1) wait for data

[PHP] Breaks on socket_read

2004-05-14 Thread René Fournier
Can anyone suggest why this script (well, part of the script) fails on the while(($bug=socket_read... line after it successfully loops several times? (Of course, it is only after it timesout, but that is what I need it to do.) ---CODE-- $msg_recv = 3; $timeout =

[PHP] Missing data types?

2004-05-14 Thread René Fournier
I need to pack() data in PHP according to a typedef'ed C format structure, but there seems to be two problems (as per the docs: http://ca.php.net/manual/en/function.pack.php). First, in PHP there is no format option for long signed integers, big-endian byte order, just signed long (always 32

[PHP] socket_select()

2004-05-20 Thread René Fournier
All the examples I see of socket_select() are on socket servers. But is it reasonable/feasible to use socket_select() on a socket client, that is receiving data periodically from a server (and when not receiving, doing something else)? ...Rene -- PHP General Mailing List (http://www.php.net/)

[PHP] Blocking vs. Selecting

2004-05-20 Thread René Fournier
MY PROGRAM FLOW: Enter loop Wait incoming data If (incoming data) { do something } elseif (no data delay 5 seconds) { send ping to server return to top of loop

[PHP] World's simplest tutorial on socket_select???

2004-05-20 Thread René Fournier
I've seen a sweet script for a multi-client, multi-socket server in PHP (http://dave.dapond.com/socketselect.php.txt), but its purpose is quite different from mine, and it's about one billion times more complex than I need. I am building a SIMPLE socket client that makes ONE connection to ONE

[PHP] I am in Socket Paradise

2004-05-20 Thread René Fournier
Please ignore my previous I-AM-SO-FRUSTRATED-I-AM-READY-FOR-A-JACKET-WITH-REALLY-LONG-SLEEVES posts. I have managed to solve my socket woes. My simple client works loops, timesout, loops again... elegantly. (I've learned not take those PHP warnings so seriously... and to clear socket errors.)

Re: [PHP] I am in Socket Paradise

2004-05-20 Thread René Fournier
On Thursday, May 20, 2004, at 04:17 PM, Chris W. Parker wrote: René Fournier mailto:[EMAIL PROTECTED] on Thursday, May 20, 2004 2:58 PM said: Please ignore my previous I-AM-SO-FRUSTRATED-I-AM-READY-FOR-A-JACKET-WITH-REALLY-LONG-SLEEVES posts. I have managed to solve my socket woes. My simple

Re: [PHP] World's simplest tutorial on socket_select???

2004-05-20 Thread René Fournier
On Thursday, May 20, 2004, at 05:15 PM, Curt Zirzow wrote: * Thus wrote Ren Fournier ([EMAIL PROTECTED]): I am building a SIMPLE socket client that makes ONE connection to ONE server, and waits for data (socket_read)... and when no data comes for a few seconds, does something else, then waits for

Re: [PHP] How do I grab the contents of a web page?

2004-05-20 Thread René Fournier
On Thursday, May 20, 2004, at 06:42 PM, Brian Dunning wrote: On May 20, 2004, at 5:43 PM, raditha dissanayake wrote: I'm sure there's a really simple way to do this: how can I grab the source code of a specified web page and store it in a variable? Never mind, I found it: $string =

[PHP]

2004-05-31 Thread René Fournier
What's the difference between function myfunction() { } and function myfunction() { } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP]

2004-05-31 Thread René Fournier
Oops... I mean, what's the difference between function myfunction() { } and function myfunction() { } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] PHP login script

2004-05-31 Thread René Fournier
I'm looking for some good, secure login code, and found the following article: http://www.devshed.com/c/a/PHP/Creating-a-Secure-PHP-Login-Script/ Not being much of a security expert, I was wondering if anyone here could say whether this code is any good? Or if there's a better one elsewhere?

[PHP] Secure login script

2004-05-31 Thread René Fournier
The link I posted previously is causing me some grief, apparently because I don't know the first thing about object-oriented PHP or PEAR. Here's the thing: If I MUST learn these two things in order to copy the security of the sample script, I will, but is it really necessary in your opinion?

[PHP] Mapping solutions

2004-06-04 Thread René Fournier
I'm looking for a good mapping solution for a PHP project I'm working on, and wondered if any of you would be able to recommend one. Basically, I would like to be able to pass this Map Module several values: Latitude, longitude, map scale (e.g., 5KM x 5KM), and map resolution (500 pixels x 500

[PHP] Can someone explain this?

2004-06-08 Thread René Fournier
$dec = -71788; echo $dec.\n; $hex = dechex($dec).\n; $dec2 = hexdec($hex).\n; echo $dec2.\n; -= PRODUCES: =- -71788 3961595508 Is this something about signed versus unsigned integers? What I really would like to do is convert that negative number (-71788), which I suppose is unsigned

Re: [PHP] Can someone explain this?

2004-06-08 Thread René Fournier
OK, that makes sense. But here's the problem: I receive binary data from SuperSPARC (big-endian), which I need to unpack according to certain documented type definitions. For example, let's say that $msg has the value 3961595508 and is packed as an unsigned long integer (on the remote SPARC).

Re: [PHP] Can someone explain this?

2004-06-08 Thread René Fournier
Thanks. The fact that this behaviour is a bug somehow makes me feel better. At least I'm not crazyor, not as crazy as I thought. ...Rene On Tuesday, June 8, 2004, at 12:57 PM, Curt Zirzow wrote: * Thus wrote Ren Fournier ([EMAIL PROTECTED]): Now, thanks to your suggestions, I can convert that

[PHP] Expedia.com

2004-06-09 Thread René Fournier
When Expedia.com is searching for flights, it displays a page with a little animated GIF progress bar, then display the results. How do they do that? How does the page sit idle until the query is finished, and then sends a new page with the results? I was thinking that they might use

Re: [PHP] Expedia.com

2004-06-09 Thread René Fournier
I guess a better question would be, what is the best practices way of showing a Please wait... page while a server operation is performed (which could take 5 or 45 seconds), then make the page display the resulting data (via reload, or slow-load, or whatever)? Would love to find an article on

[PHP] MapServer and PHP/MapScript

2004-06-14 Thread René Fournier
Anybody have any experience (good or bad) with MapServer? (http://mapserver.gis.umn.edu/) And if so, can you comment on how good or bad PHP/MapScript is? (http://mapserver.gis.umn.edu/doc42/phpmapscript-class-guide.html) Thanks. ...Rene -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Re: MapServer and PHP/MapScript

2004-06-14 Thread René Fournier
Can I ask, what platform/OS you are running it on? I am looking to build it for OSX 10.3... ...Rene On Monday, June 14, 2004, at 03:16 PM, Lester Caine wrote: René fournier wrote: Anybody have any experience (good or bad) with MapServer? (http://mapserver.gis.umn.edu/) And if so, can you

[PHP] Socket trouble

2004-10-28 Thread René Fournier
. the remote end point has closed the connection). Does this end of communication include cases when the socket server dies without gracefully disconnecting? How could my code check for this zero length string? Any help is much appreciated. Thanks! ...René --- René Fournier www.renefournier.com

[PHP] How to make a PHP Socket client crash-proof?

2004-12-08 Thread René Fournier
endlessly, really fast). Many thanks in advance for any suggestions you can offer. ...René --- René Fournier www.renefournier.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] How to make a PHP Socket client crash-proof?

2004-12-10 Thread René Fournier
to be sent? Does the server understand that signal? -- Like Music? http://l-i-e.com/artists.htm ...René --- René Fournier www.renefournier.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Socket Tutorial

2004-07-08 Thread René Fournier
Hi Andrew, This one helped me a lot: http://www.devshed.com/c/a/PHP/Socket-Programming-With-PHP/ This isn't a tutorial, but good sample code for a multi-client chat server: http://dave.dapond.com/socketselect.phps ...Rene On Monday, July 5, 2004, at 12:39 PM, Andrew wrote: Hi guys, Can somebody

[PHP] Interactive Voice Response (IVR)

2004-07-08 Thread René Fournier
Hi, I am looking for an IVR system that would allow a person to call a number (via telephone), and then using the keypad to send commands that are processed by a PHP script whichafter hitting a mySQL database a few timesresponds with a value (success/failure) which then is played back to the

[PHP] convert degrees to heading

2004-07-16 Thread René Fournier
I have to write a little function to convert a direction from degrees to a compass -type heading. 0 = West. 90 = North. E.g.: from: 135 degrees to: NW Now, I was planning to write a series of if statements to evaluate e.g., if ($heading_degrees 112.5 $heading_degrees 67.5) {

Re: [PHP] Re: convert degrees to heading

2004-07-16 Thread René Fournier
Works beautifully. Thanks! ...Rene On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote: function degrees2compass($degrees) { $compass = array('N', 'NNW', 'NNE', 'NE', ...); $index = $heading_degrees / sizeof($compass); return $compass[$index]; } -- PHP General Mailing List

[PHP] Output buffering (gzip) on Mac OS X 10.3.5

2004-08-12 Thread René Fournier
(ob_gzhandler); session_start(); // ...code ob_end_flush(); header('Content-Encoding: gzip'); ? I've tried numerous permutations of this and other code, but have yet to get anything to compress. Any ideas? ...René --- René Fournier www.renefournier.com -- PHP General Mailing List (http://www.php.net

[PHP] Multiple web sites, one IP address...

2004-09-15 Thread René Fournier
appreciate it. ...Rene ...René --- René Fournier www.renefournier.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] What was the unix timestamp of last week, Monday 12:00 am?

2009-04-12 Thread René Fournier
I'm trying to write a [simple] function, such that: function earlier_unix_timestamp () { $now = mktime(); [...] return $then; // e.g., 1238983107 } Anyone have something already made? There seem to be many ways to skin this cat, with date() arithmetic,

[PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-09 Thread René Fournier
Strange problem I'm having on Mac OS X Server 10.6 running PHP 5.3. Any call of file_get_contents() on a local file works fine -- the file is read and returned. But any call of file_get_contents on a url -- any url, local or remote -- always returns false. var_dump (file_get_contents

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-09 Thread René Fournier
No. And it doesn't matter if the url is local (localhost, host.domain.com) or remote. On 2009-12-09, at 10:30 PM, kranthi wrote: may be unrelated to your problem... but are you behind a proxy?

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-09 Thread René Fournier
://www.google.com in your command line to see whether the network is reachable LinuxManMikeC wrote: On Wed, Dec 9, 2009 at 8:02 AM, LinuxManMikeC linuxmanmi...@gmail.com wrote: On Wed, Dec 9, 2009 at 6:45 AM, René Fournier m...@renefournier.com wrote: Strange problem I'm having on Mac OS X

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-10 Thread René Fournier
): failed to open stream: Operation now in progress in //.php on line 7 bool(false) Does that help with the diagnosis? On 2009-12-10, at 12:28 AM, Richard Quadling wrote: 2009/12/9 René Fournier m...@renefournier.com: It is, and I use curl elsewhere in the same script to fetch remote

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-11 Thread René Fournier
: Warning: file_get_contents(http://www.google.com): failed to open stream: Operation now in progress in //.php on line 7 bool(false) Does that help with the diagnosis? On 2009-12-10, at 12:28 AM, Richard Quadling wrote: 2009/12/9 René Fournier m...@renefournier.com: It is, and I use

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-12 Thread René Fournier
external connection. Let me know when your problem is fixed. Also I tried the below code and it works fine- ?php $str = file_get_contents ('http://www.google.com'); echo $str; ? Thanks, Gaurav Kumar 2009/12/11 René Fournier m...@renefournier.com Hi Gaurav

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-13 Thread René Fournier
); // close cURL resource, and free up system resources curl_close($ch); ? Thanks, Gaurav Kumar 2009/12/13 René Fournier m...@renefournier.com The thing is, the file_get_contents() fails the same way on local URLs -- that is, web sites hosted on the same machine. Or even using

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-13 Thread René Fournier
PHP Version 5.3.0 Directive Local Value Master Value allow_call_time_pass_reference Off Off allow_url_fopen On On 2009-12-14, at 12:26 AM, Gaurav Kumar wrote: What is the value for allow_url_fopen in your php.ini? It should be 1. 2009/12/13 René Fournier m

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-14 Thread René Fournier
? Bueller? On 2009-12-14, at 10:05 PM, Gaurav Kumar wrote: Sorry buddy, I cant think of anything else which is going on wrong. 2009/12/14 René Fournier m...@renefournier.com PHP Version 5.3.0 Directive Local Value Master Value allow_call_time_pass_referenceOff

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-14 Thread René Fournier
On 2009-12-14, at 10:44 PM, Cafer Şimşek wrote: René Fournier m...@renefournier.com writes: 4. as per php.ini, allow_url_fopen On Look at from phpinfo() the settings is already On. Yes, I know. Which is why it's odd that the function fails on URLs. -- PHP General Mailing List (http

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-15 Thread René Fournier
On 2009-12-15, at 11:55 PM, Richard Quadling wrote: Do you have a default stream context defined for the http stream? Nope. A _LONG_ time ago, when I was using a firewall with NTLM authentication (which PHP doesn't deal with), I had to route all my calls through a local proxy. This was

Re: [PHP] file_get_contents ($file) works -- file_get_contents ($url) returns false

2009-12-15 Thread René Fournier
On 2009-12-15, at 11:55 PM, Richard Quadling wrote: Do you have a default stream context defined for the http stream? Nope. A _LONG_ time ago, when I was using a firewall with NTLM authentication (which PHP doesn't deal with), I had to route all my calls through a local proxy. This was

[PHP] Increasing maximum file descriptors (OS X Lion 10.7, PHP 5.3.8 via Macports)

2011-11-07 Thread René Fournier
I have a working socket server in PHP that I wish to improve (allow for more socket connections). I am running into a limit I can't crack, related to the max number of incoming socket connections. Using Macports for package management... I've recompiled PHP with the --enable-fd-setsize=2048 in

<    1   2