Re: [PHP] libxml_set_streams_context
On May 17, 2005, at 10:24 PM, Richard Lynch wrote: I don't know much about that fancy new stream stuff, or the XML crap, but you've got zero (0) lines of code in there to do anything useful when the functions fail. no functions fail. what I'm expecting is that with libxml_set_streams_context(), I've correctly sent an HTTP If-Modified-Since Request Header along with the HTTP GET in the DOMDocument::load() call. what I'm seeing is that somehow I haven't, since the the DOMDocument::load() call returns the file (with an HTTP 200 status in the response header) even though I know the file has not been modified since the If-Modified-Since date (confirmed by looking at the Last-Modified date in the response header). the fact that there is no failure, and no error message that I can examine or test is exactly why I'm scratching my head and asking if anyone who does know something about stream contexts can offer some pointers. I don't think I need any help with the XML crap, as you put it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] libxml_set_streams_context
On May 18, 2005, at 1:20 PM, Richard Lynch wrote: *YOU* have check their return value to see if it's 'false' or -1 or 0 and, if so, *YOU* have to call another function to get the error message and error code. This is what I am suggesting is missing big-time in your code. Yes, you made your point in your first reply -- I'm clueless and don't know the first thing about basic defensive coding. Thanks for going out of your way -- twice -- to be so helpful. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] libxml_set_streams_context
On May 18, 2005, at 4:10 PM, Jared Williams wrote: Sure the server is checking if modified since headers? I'm capturing the response headers from the remote server, so I can see that. Just tried a bit of code here and it seems to be working as expected (5.0.4 Win32) 1) I made an initial mistake by running my PHP script(s) from the command line and not from a server. 2) but now when running my PHP script(s) from a server I see that: file_get_contents() with a conditional get in a stream context works as expected; that is, the remote server returns a 304 not modified HTTP response header only. (if doing this with file_get_contents(), then the libxml_set_streams_context() function call is of course irrelevant). DOMDocument::load() with a conditional get in a stream context set via libxml_set_streams_context() shows odd results; that is, the remote server returns a 304 not modified in the HTTP response header, but also returns the file contents as well (!!??). That's a bit baffling -- a server shouldn't do that, since the 304 response header ends with connection: close, so I don't know how or why the file contents are being captured too. I would think a 304 response header means that the request header was properly interpreted and nothing but a header would be returned. Hard to know if the problem is on my end or on the remote server side. I note also that stream contexts send only as HTTP/1.0, and the remote server is returning HTTP/1.1, and I just don't know if that's a possible factor in this or not. Anyhow, I have a workable solution which is sort of ok -- use file_get_contents() with a conditional get in a stream context to fetch a remote file on an if-modified-since basis, then stuff the string result into a new DOMDocument() object and have at it that way. But of course I'm puzzled as to why libxml_set_streams_context() is doing what it's doing, and it would be nice to know how to get it to work if it can and should work elsewhere for others. Thanks for a helpful reply. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] libxml_set_streams_context
On May 18, 2005, at 7:07 PM, Jared Williams wrote: Heh, yes indeed most baffling... Libxml must be performing some sort of cacheing, I guess. Doesn't appear to be requesting twice (once with the if-modified-since header, and again without atleast) well, thanks for the confirm on that. I thought of a possible double request also (with header, then without) as well; I guess I'll have to break out the packet sniffer and see if that tells me anything. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] libxml_set_streams_context
I'm trying to use libxml_set_streams_context() to load a remote xml file via HTTP conditional GET with DOMDocument::load() by stuffing an 'If-Modified-Since: --- HTTP header into the stream, but no matter how I try it I always get an HTTP 200 response when I know the last- modified date is well before my if-modified date string. I've confirmed via curl -H on the command line that I can do it properly and get an HTTP 304 as expected, but I don't know what I'm not doing right with libxml_set_streams_context(). Here's my code: $opts = array('http'=array('method'=GET, 'header'=If-Modified- Since: Wed, 18 May 2005 23:55:29 GMT\r\n)); $context = stream_context_create($opts); libxml_set_streams_context($context); $doc-load('http://www.somewhere.com/somefile.xml'); echo $doc-saveXML(); using the same $context resource, this also produces the same result, when I expect it should work. file_get_contents('http://www.somewhere.com/somefile.xml', false, $context); I have php 5.0.4 compiled with libxml2 (2.6.16) on Mac OS X 10.4. I imagine I'm not doing something correctly, but can't figure out what it is. Any help? -- Bill Hoffman [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What are you using for please wait?
I would just like to see how people are handling long running PHP scripts. I have been using a page in the middle that says please wait and then using a META tag that forwards the user on to the intended page. This has been working well up until now. I now have a page that is posting an array on to the next page. The array can have as many 1500 elements pulled from a database. It works fine when I post directly to destination page. The problem is that the query can take up to 2 minutes and the I am not giving the user any indication as to what is going on. I can't figure out how to pass the array on to the destination page with a forward page in the middle. I have used hidden values for this in the past but 1500 hiddens seems schlocky. I am now looking into a possilbe other method for letting the users know it will be a minute with the middle forward page. I have found a few javascript loading functions but have not been able to implement them successfully. Please E-mail directly if you are using a more elegant solution. Thanx in advance, PHP is better then Elvis BEH
[PHP] ftp_login problem
I wanted to check with all of you before I report a bug. Here is the problem: I am attempting to access a OS2 server via ftp. When I login on the command line as anonymous to this server it does not require a password. When I try to login via PHP (ftp_login) it requires that I use a password. When I try to just put in just any password ftp_login comes back with a login failed message. here is the error: Warning: ftp_login: User anonymous logged in. in /home/httpd/html/php/ftpget.php on line 15 You can see the message that the server is returning is saying that my login was ok but ftp_login does not return success. If anyone has insight into this please let me know, BEH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] LDAP problems
Here is my environment again: System Linux [EMAIL PROTECTED] 2.2.5-15 #1 Mon Apr 19 22:21:09 EDT 1999 i586 unknown Build Date Sep 7 2000 Configure Command './configure' '--with-apxs=/usr/local/apache/bin/apxs' ' --with-config-file-path=/usr/local/apache/conf' '--enable-versioning' ' --with-mysql' '--enable-ftp' '--with-gd=/usr/local/gd' ' --enable-bcmath=yes' '--disable-debug' '--enable-memory-limit=yes' ' --enable-track-vars' ' --with-openlink=/usr/local/odbc' ' --with-ldap=/usr/local/openldap' Server API Apache Virtual Directory Support disabled Configuration File (php.ini) Path /usr/local/apache/conf ZEND_DEBUG disabled Thread Safety disabled Here is my new problem: I tried a the new version of PHP (4.0.4pl1) and openldap (2.0.7) now. PHP configures fine and compiles fine. When I go to restart apache it gives me the following error: Syntax error on line 237 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: ldap_value_free Does anyone know what this means or how to make it go away? The problem with having to compile everything in is now apache and php are down because of my ldap problem. It would be nice if it would start apache and php and give me a message that ldap is not installed. One bad apple/module should not spoil the whole bunch. Thanx in advance for any help, BEH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Problems compiling LDAP into php 4.0.2
I switched from Netscape to Openldap and it now compiles fine. Unfortunately Apache bombs when I try to start it with the following error: Syntax error on line 237 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: undefined symbol: ldap_value_free Any ideas as to why this would happen would be much appreciated, BEH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]