Jump to content

shelluk

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by shelluk

  1. The wait.php with the wait is just for the purpose of demonstrating a delay which I might see in what I am going to try and achieve. I think I've nailed it though, this looks like it does exactly what I want All queries get processed in quick succession, not after the last one completed. <html> <head> <title>This is a ajax test page</title> <script src="[url="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js%22></script>"]http://ajax.googleap...n.js"></script>[/url] <script language="Javascript" type="text/javascript"> function gogo(x) { for(var y=0;y<=x;y++) { populate(y); } } function populate(i) { var xmlhttp; if (window.ActiveXObject) { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } else { xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { document.getElementById('row'+i).innerHTML = xmlhttp.responseText; } } document.getElementById('row'+i).innerHTML = 'Loading...'; xmlhttp.open('GET', 'wait.php?q='+i, true); xmlhttp.send(null); } </script> </head> <?PHP $x = '10'; echo '<body onload="gogo('.$x.')">'; for( $y=0; $y<=$x; $y++ ){ echo ' <div id="row'.$y.'">#'.$y.'#</div>'.PHP_EOL; } ?> </body> </html>
  2. Actually stijn's didn't work as intended. row 0 = 0 secs row 1 = 1 secs row 2 = 3 (2+1) secs row 3 = 6 secs (3+2+1) secs .. and so on I want all to start at the same time. No waiting. I'll take a closer look at what you said Christian. It's a shame div doesn't support an onload!
  3. Hi Christian I did what stijn said and it did work. I did wonder before hand though and did try making xmlhttp an array. It didn't help though. Thanks Michelle
  4. That works, thanks stijn0713! May be it's good to ask if I'm going around this the right way. The above is just an example for me to get my head around this (I'm new to Javascript/AJAX). I have a variable amount of queries (and so divs), with each out putting to their own div to process. While each one is being processed (some queries could take 5 secs to process while some are instant), I want it to show 'Loading...' in the div rather than the whole page being on hold for 5 seconds (or 10 if 2 of them take 5 seconds to process for example). Thank you
  5. Hi At risk of looking liking an idiot here I feel. Here goes though! I have the following code. Only the one with 'row10' changes though. Everything else sticks on 'Loading...'. Looking at the Apache logs I can see it is requesting each page (wait.php?q=0.. waiting.php?q=1... and so on up to 10). index.php <html> <head> <title>This is a ajax test page</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script language="Javascript" type="text/javascript"> function ajax(id) { for(var i=0;i<=id;i++) { rowid = 'row'+i; var xmlhttp; if (window.ActiveXObject) { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } else { xmlhttp = new XMLHttpRequest(); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 3) { } if (xmlhttp.readyState == 4) { document.getElementById(rowid).innerHTML = xmlhttp.responseText; } } document.getElementById(rowid).innerHTML = 'Loading...'; xmlhttp.open('GET', 'wait.php?q='+i, true); xmlhttp.send(null); } } </script> </head> <?PHP $x = '10'; echo '<body onload="ajax('.$x.')">'; for( $y=0; $y<=$x; $y++ ){ echo ' <div id="row'.$y.'">#'.$y.'#</div>'.PHP_EOL; } ?> </body> </html> wait.php <?PHP $q = $_GET['q']; sleep($q); echo 'That should have taken '.$q.' seconds.'; ?> Can any one point out my mistake please? Thanks Shell
  6. Hi Kicken Thank you. That did the trick Shell
  7. Hi I'm exploring the DOMDocument class for the first time to do some screen scraping. I am getting the following error though: PHP Warning: DOMDocument::loadHTMLFile(https://192.168.1.59/): failed to open stream: HTTP request failed! HTTP/1.1 505 HTTP Version not supported\r\n in /var/www/default/path/file.php on line 25 PHP Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity "https%3A%2F%2F192.168.1.59%2F" in /var/www/default/path/file.php on line 25 I've tried adding urlencode() as I saw it suggested in a few places but had no luck (and didn't expect it to help as there is nothing fancy is in the URL?). $url = urlencode('https://192.168.1.59/'); $doc = new DOMDocument(); $doc->loadHtmlFile( $url ); $xpath = new DOMXPath( $doc ); $nodelist = $xpath->query( "/html/body/div[@class='applicationPalette']/table/tbody/tr[2]/td[@class='rightContentPane']/div[@class='pad10'][1]/table/tbody/tr[2]/td[@class='itemLargeFont']" ); I think I need to force HTTP 1.0 but I'm failing at working out how. Or am I wrong all together and it's something else? Thank you!
  8. Thanks to both of you. Decided to go digging after you both mentioned extensions. It turned out to be imagick! All up to date with the stable branch of Debian so had to force a newer version of imagick down through the testing branch. I've escaped alive and with everything now working. The fact it was completing the script up to the last line was throwing me, I thought it would be bombing out before if it was a seg fault. Thank you!
  9. Thanks requinix. I've done that, after some read and writes as expected, it ends with: close(3) = 0 close(1) = 0 close(2) = 0 exit_group(0) = ? This is the last line of the script. Done. Segmentation fault I've set the last line of the script to: exit("This is the last line of the script. Done.".PHP_EOL); I am, confused.
  10. Hi I have a php script which is piped to by my mail server (exim). It runs and does what it needs to do, I even have as the last 2 lines the following, which run and print "Done"! exit("Done"); ?> Yet the script terminates with "Segmentation fault (core dumped)". I have tried to do a backtrace on the core dump file but with no luck. Never gone in to to gdb and backtraces before so don't really know what I'm doing to be honest. I've tried recompiling php with --enable-debug which I am assuming it has done but I am not sure how to check. # gdb /usr/bin/php5 /tmp/core-dumps/core-php.30729 GNU gdb (GDB) 7.0.1-debian Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i486-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/php5...Reading symbols from /usr/lib/debug/usr/bin/php5...done. (no debugging symbols found)...done. warning: core file may not match specified executable file. [New Thread 30729] warning: Can't read pathname for load map: Input/output error. Reading symbols from /lib/i686/cmov/libcrypt.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libcrypt.so.1 Reading symbols from /usr/lib/libz.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /usr/lib/libonig.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libonig.so.2 Reading symbols from /usr/lib/i686/cmov/libssl.so.0.9.8...(no debugging symbols found)...done. Loaded symbols for /usr/lib/i686/cmov/libssl.so.0.9.8 Reading symbols from /usr/lib/libdb-4.8.so...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libdb-4.8.so Reading symbols from /usr/lib/libqdbm.so.14...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libqdbm.so.14 Reading symbols from /lib/libbz2.so.1.0...(no debugging symbols found)...done. Loaded symbols for /lib/libbz2.so.1.0 Reading symbols from /lib/libpcre.so.3...(no debugging symbols found)...done. Loaded symbols for /lib/libpcre.so.3 Reading symbols from /lib/i686/cmov/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libm.so.6 Reading symbols from /lib/i686/cmov/libdl.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libdl.so.2 Reading symbols from /lib/i686/cmov/libnsl.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libnsl.so.1 Reading symbols from /usr/lib/libgssapi_krb5.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libgssapi_krb5.so.2 Reading symbols from /usr/lib/libkrb5.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libkrb5.so.3 Reading symbols from /usr/lib/libk5crypto.so.3...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libk5crypto.so.3 Reading symbols from /lib/libcom_err.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/libcom_err.so.2 Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libxml2.so.2 Reading symbols from /lib/i686/cmov/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libc.so.6 Reading symbols from /usr/lib/i686/cmov/libcrypto.so.0.9.8...(no debugging symbols found)...done. Loaded symbols for /usr/lib/i686/cmov/libcrypto.so.0.9.8 Reading symbols from /lib/i686/cmov/libresolv.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libresolv.so.2 Reading symbols from /lib/i686/cmov/libpthread.so.0...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libpthread.so.0 Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /usr/lib/libkrb5support.so.0...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libkrb5support.so.0 Reading symbols from /lib/libkeyutils.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libkeyutils.so.1 Reading symbols from /usr/lib/libxcb.so.1...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libxcb.so.1 Reading symbols from /lib/i686/cmov/librt.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/librt.so.1 Reading symbols from /usr/lib/libXau.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXau.so.6 Reading symbols from /usr/lib/libXdmcp.so.6...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libXdmcp.so.6 Reading symbols from /usr/lib/php5/20090626+lfs/suhosin.so...(no debugging symbols found)...done. Loaded symbols for /usr/lib/php5/20090626+lfs/suhosin.so Reading symbols from /lib/i686/cmov/libnss_files.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/i686/cmov/libnss_files.so.2 Core was generated by `php -q ./mailReader.php'. Program terminated with signal 11, Segmentation fault. #0 0xb6472562 in ?? () (gdb) bt #0 0xb6472562 in ?? () #1 0xb647269b in ?? () #2 0xb6470d40 in ?? () #3 0xb6f96955 in start_thread () from /lib/i686/cmov/libpthread.so.0 #4 0xb71e31de in clone () from /lib/i686/cmov/libc.so.6 # uname -a Linux eeever 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686 GNU/Linux PHP Version => 5.3.3-7+squeeze14 I think the issue is "no debugging symbols found". I install php5-dbg but it clearly hasn't worked. Has any one either any idea why it is seg faulting even though it executes to the end, or what I'm doing wrong with trying to debug it please?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.