RE: [PHP] Re: Doing an HTML POST using header()
Forging a POST is a complicated task when compared to its GET cousin, and there is no 'easy' way You must either use CURL, or write your own mini web client... Francis wrote: using NT? all I need it for is so the user can skip a registration step put its all coded using POST rather than GET, its gonna be quite simple but whats the syntax? there must be a way to do it... Pete James [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Don't redirect, use curl to post your data to the new page. Francis wrote: I'm trying to redirect to another website but doing a post to that website at the same time. (ie POST rather than a GET (eg: header(Location: www.anothersite.com/index.php?page=22); ) How do you do an HTML post using the header() whats the syntax? I just cant find it anywhere. Thanks google for posttohost; http://www.php-faq.com/postToHost.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using COM to generate excel file - php version of vb Sheets(Report First page).Copy After:=Sheets(1)
Win2Kpro, PHP4.2.1, Apache 1.3.26dev I would like to make a copy of a sheet in an existing excel spreadsheet from within PHP using COM. I can open an existing .xls file and rename a sheet using; 8= $excel = new COM(Excel.Application) or die(Excel could not be started); $excel-DisplayAlerts = 0;// turn off alerts $workbook = c:\\tmp\\tst1.xls; $wkb = $excel-application-Workbooks-Open($workbook) or Die (Did not open); $sheet1 = $wkb-Worksheets(1); //Select the sheet $sheet1-activate; //Activate it $sheet1-name=Report First page; 8= To try and work out how to copy a sheet I created a macro in excel; Sheets(Report First page).Select Sheets(Report First page).Copy After:=Sheets(1) Sheets(Report First page (2)).Select Sheets(Report First page (2)).Name = new Sheet My problem is that I can't work out the php version of Sheets(Report First page).Copy After:=Sheets(1) ie there is a space between Copy and After and how do I get the := operator? Any suggestion much appreciated. (I have looked through the online docs, mailing list, ms and googled but havn't found a solution) Regards Andrew Braund -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] base64_encode
Googling on ascii table base64 got me; http://ulla.mcgill.ca/arts150a/sample_exam.htm a nice little table with the base 64 characters (also got http://email.about.com/library/weekly/aa070201a.htm which discribes base64) So in answer to your question the extras look like + and /. 26+26+10+2=64 sounds right. HTH Andrew Braund -Original Message- From: Gerard Samuel [mailto:[EMAIL PROTECTED]] Sent: Thursday, 27 June 2002 11:15 To: php-gen Subject: [PHP] base64_encode What other characters are possible from the output of base64_encode() except [A-Za-z0-9] ?? Thanks -- Gerard Samuel http://www.trini0.org:81/ http://dev.trini0.org:81/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Week of month
How about; echo It is week .((int)(date(j)/7)+1). of the month.br; -Original Message- From: Jon Farmer [mailto:[EMAIL PROTECTED]] Sent: Thursday, 1 November 2001 20:14 To: PHP Masters; Sheni R. Meledath Subject: Re: [PHP] Week of month Is there any way to find out the week of the month. Today is in the first week of month. That is, a function like weekofmonth() which displays 1 today 2 next week. No builtin function in PHP. You will need to search to see if some kind and generous soul has published their code for this purpose or write your own. Remember the actual first day of a week can be country specific. Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send blank email to [EMAIL PROTECTED] -- 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]
RE: [PHP] how can I do this !!
show_source(basename($PHP_SELF)); At 02:26 PM 10/25/2001, Alawi wrote: i have txt file have this words -- bla bla bla [phpcode] ? echo 'hello word'; ? [/phpcode] bla bla bla --- now I want to convert the code that are between [phpcode] and [/phpcode] to colorized code .. How I can do that Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford It is only with the heart that we see rightly; what is essential is invisible to the eye. --Antoine de Saint Exupéry -- 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]
RE: [PHP] Create Array??
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, 23 September 2001 15:39 To: [EMAIL PROTECTED] Subject: [PHP] Create Array?? Hi, If I have a value $num = 32; based on this how can I create an Array of numbers 1 - 32, something like this... ? $num = 32; $num = 32; $iary = array(); for ($i = 1; $i = $num; $i++) { $iary[$i] = $i; // if you actually wanted the array to contain 1 etc then try // $iary[$i] = \$i\; // Do something } // And now $iary = (1,2,3,etc var_dump($iary); ? Any suggestions?? I cannot use array_push as this has to work on a PHP3 server. TIA Ade -- 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]
RE: [PHP] Create Array?? More
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, 23 September 2001 16:46 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Create Array?? More Ok, Thanks for the input, unfortunately it didn't help me solve my overall problem, so I will post that and see if anyone has any suggestions... I am basically displaying the Usernames from a .htpasswd file like this... $File=$Path$Directory1/.htpasswd; $fd = fopen ($File, r); $Content = fread ($fd, filesize ($File)); $Content=ereg_replace (\n,:, $Content); // Explode the file using : as seperator $MyContent = explode (:, $Content); // Count it up $LoU = count($MyContent)-1; // Close the File fclose($fd); for ($a=0; $a $LoU; $a+=2) { printf(\nTD%s/TD%sTD/TD, $MyContent[$a], $MyContent[$a+=2]); } This is working perfectly, perhaps not for odd numbers of users? Try; (untested!) echo tr\n; for ($i=0; $i*2 $LoU; $i++){ printf(td%d./tdtd%s/TD, $i, $MyContent[$i*2]); if( $i % 2){ // new line after each two entries echo /trtr\n; } } echo /tr\n; but what I would like to do is display a number next to each one, at the moment it displays... UserName1 UserName2 UserName3 UserName4 What I would like it to do is 1. UserName1 2. UserName2 3. UserName3 4. UserName4 I cannot figure a way to use $a because it has to skip by 2 in order not to display the encrypted passwords..any suggestions??? TIA Ade -- 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]
RE: [PHP] comparing
How about; SELECT product, count(*) AS Total FROM table GROUP BY product ORDER BY total DESC -Original Message- From: Teqila MAN [mailto:[EMAIL PROTECTED]] Sent: Saturday, 15 September 2001 16:43 To: [EMAIL PROTECTED] Subject: [PHP] comparing Hello, What is the simple mod to compare values for example. (we have a mysql tabl e) id -- product 1-cola 2 -cola 3 - cd 4 -cd 5 - cola How to make a mysql query that wokuld print me what products i have in most. Teqilaman -- 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 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]
RE: [PHP] Loop error?
-Original Message- From: PHP List [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 15 August 2001 09:20 To: php Subject: [PHP] Loop error? Hi, Can anyone tell me why this is a never ending loop? $i=0; $count = 1; while ($count $i); ^ { echo $i br; $i++; } Chris -- 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]
RE: [PHP] Sort an array by its values
I think array_multisort is supposed to do this but I couldn't get it to work. Have a look at the usort call in the following routine; // Reads a directory and puts filenames into a array sorted by date function GetFiles ($DataPath, $files, $nfiles) { $handle=@opendir($DataPath); if ($handle) { $nfiles = 0; while (false!==($file = readdir($handle))) { if ($file != . $file != .. ) { $files[$nfiles][name] = $file; $files[$nfiles][date] = filemtime($DataPath.\\.$file); $nfiles++; } } if($nfiles1){ usort($files, create_function( '$a,$b', 'return $a[date]==$b[date]?0:($a[date]$b[date]?1:-1);') ); } closedir($handle); } } HTH Andrew Braund -Original Message- From: Aaron Bennett [mailto:[EMAIL PROTECTED]] Sent: Sunday, 8 July 2001 17:56 To: Php-General (E-mail) Subject: [PHP] Sort an array by its values Hi All, I'm trying to sort an array of objects by the value of one of those objects... for instance, I'll have an object with 2 properties, id and score, where id is unique and score is its relevant (and sometimes simelar) score. i've tried using sort() and asort() but i can't figure how to base the sorting off the value (i.e. score) of the object in the array. Any help? -- Aaron -- 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]
RE: [PHP] [Apache] Win32 Virtual Host - Sub Domain
-Original Message- From: Jon Shoberg [mailto:[EMAIL PROTECTED]] Sent: Sunday, 22 April 2001 00:39 To: phpgeneral Subject: [PHP] [Apache] Win32 Virtual Host - Sub Domain Sorry for the OT post but this has me stumped and Google is not giving me any good leads. A good lead is the Apache manual on virtual hosting; http://httpd.apache.org/docs/vhosts/index.html in particular; http://httpd.apache.org/docs/vhosts/name-based.html in the examples shown there you will notice the virtualHost line is; VirtualHost 111.22.33.44 ie it uses an IP address, your config uses a host name; VirtualHost test.localhost so on startup Apache will try to resolve test.localhost to an IP address. It fails so ignores the virtual host entry. You could probably fix it by adding an entry to you hosts file like 127.0.0.1 test.localhost but I think this would only be good for requests coming from a browser on the server machine. For simple installations I think you will find an entry like; VirtualHost * will work well (it also allows you to use dynamic DNS without changing your config file). The example in the documentation also does not use a trailing slash in the document root. I don't know if this is important but with some config directives it is so I generally follow the documentation *exactly*. So the complete virtual host entry would be; VirtualHost * ServerAdmin webmaster@localhost DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/test" ServerName test.localhost ErrorLog logs/test.localhost-error_log CustomLog logs/test.localhost-access_log common /VirtualHost HTH Andrew Braund I am trying to setup Apache with PHP on Win32 (don't ask why). Anyhow, PHP is working great but virtual hosting is not going so well. When the browser brings up http://localhost/ it reads from [Apache Root]/apache/htdocs as defined by: #*** Good Virtual ** VirtualHost * ServerAdmin webmaster@localhost DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/" ServerName localhost ErrorLog logs/error_log CustomLog logs/access_log common /VirtualHost #*** What are are tring to do is setup http://test.localhost/ and it is not working here is the virtual host and apache restart ... #*** Bad Virtual *** [Sat Apr 21 09:55:33 2001] [error] Cannot resolve host name est.localhost --- ignoring! The Apache service is restarting. The Apache service has restarted. VirtualHost test.localhost ServerAdmin webmaster@localhost DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs/test/" ServerName test.localhost ErrorLog logs/test.localhost-error_log CustomLog logs/test.localhost-access_log common /VirtualHost #*** Any thoughts on getting Win32 to resolve that test.localhost name ? Thanks -- 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 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]
RE: [PHP] Output HTML Compression
you might want to look at mod_gzip http://www.remotecommunications.com/apache/mod_gzip/ Regards Andrew Braund -Original Message- From: Floyd Piedad [mailto:[EMAIL PROTECTED]] Sent: Friday, 20 April 2001 13:33 Cc: [EMAIL PROTECTED] Subject: [PHP] Output HTML Compression Hi, Any tips on how to speed-up dynamic page loads by either lessening the HTML file sent or compressing it? I found two ways but don't exactly know how to do it. 1. Enable output buffering with compression. This seems to be only available on php4.04. Is there a way to do this with php4.01? 2. Remove extraneous whitespaces. I normally program with heavy use of indention, especially in table outputs, to make code more readable. But the html files sent out also have these indentations and whitespaces. Is there a code that can clean these out? Thanks, Floyd -- 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 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]
RE: [PHP] Regular Expression
LinuxSA http://www.linuxsa.org.au/ meeting a couple of days ago was on regex, some notes are at; http://www.fornax.net/regex2/ or part 1 at; http://www.fornax.net/regex/ HTH Andrew Braund -Original Message- From: Jeroen Geusebroek [mailto:[EMAIL PROTECTED]] Sent: Thursday, 19 April 2001 06:25 To: [EMAIL PROTECTED] Subject: Re: [PHP] Regular Expression oops. The expression should read '/\[([^\]]+)\]/' Thanks all, i used this code and it works: preg_match("/\[(.+)\]/",$msg_array[$i],$segments); $title = trim($segments[1]); $description = ereg_replace("\[ $title \]", "", $msg_array[$i]); Does anyone know a good regex tutorial? I'll probably bump into it again. Regex'es seem to be very usefull. Regards, Jeroen Geusebroek -- 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]
RE: [PHP] read headers.
wget -s apache.org works on *nix or windows, puts all headers and content to a file eg saves to index.html which contains; ==8 HTTP/1.1 200 OK Date: Wed, 04 Apr 2001 09:13:58 GMT Server: Apache/2.0.16 (Unix) Cache-Control: max-age=0 ===8=== etc then content PS Apache 2.0.16 could be beta, have four +1's :-) -Original Message- From: Geir Eivind M?rk [mailto:[EMAIL PROTECTED]]On Behalf Of Geir Eivind Mork Sent: Wednesday, 4 April 2001 18:22 To: [EMAIL PROTECTED] Subject: Re: [PHP] read headers. On 04 Apr 2001 03:15:25 -0500, Plutarck wrote: As in when you pull up a site in your browser, or when you use a script to make an http connection to another site? I want to make a connection to a foreign webserver and fetch the headers as well as the content. I was wondering of a 'painless' way instead of messing around on a lower level. If you are using your browser on a windows box you can use a program called Proxomitron. Just use it's log window to see all the HTTP connection fun. I haven't access to a windows computer. beside, that wouldn't help me anyway. -- php developer / CoreTrek AS| Be careful when a loop exits to the same Sandnes / Rogaland / Norway| place from side and bottom. web: http://www.moijk.net/ | -- 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]
RE: [PHP] Java applet can't read PHP output !!
Works for me! I don't think PHP is the problem. I first tried this with PHP as cgi and it worked fine, then retested with PHP as module and still worked fine. Platform; NT4 SP6 Server Version: Apache/1.3.19(Win32) mod_jk PHP/4.0.4pl1 DAV/1.0.2 applet code; ==8 package testrd; import java.applet.*; import java.io.*; import java.net.*; public class Applet1 extends Applet { public Applet1() { } public void init() { try { String line; URL u=new URL("http://192.168.0.22/tst.phpm"); URLConnection uc=u.openConnection(); DataInputStream d=new DataInputStream(uc.getInputStream()); while ( (line=d.readLine()) != null ) { System.out.println(line); } } catch(Exception e) { e.printStackTrace(); } } } ==8 tst.php; ==8 ?php print "some module text ...\n"; print "some more text ...\n"; ? ==8 -Original Message- From: Peter Choynowski [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 4 April 2001 10:09 To: [EMAIL PROTECTED] Subject: Re: [PHP] Java applet can't read PHP output !! I have tried putting \n and a header command with no help. My current theory is that php is manipulating the socket options in some way, making Java drop the connection ( since Perl or sh CGI script works with the same Java code). I have tried to modify the applet to use read method in place of readLine with the same results - it reads fine from Perl or SH but not from PHP - I have written a large quantity of PHP code and want to stick to using only PHP ( makes support easier ). My last option is running a tcpdump on the connection and see what is flowing on the cable and look for differences, or looking through code and trying to find the php - apache interface code :-( Bye, Peter -- 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 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]
RE: [PHP] Delaying Printed Output
This topic comes up from time to time... Some previous information, if you get any further please post it to the list. A while ago I saw a web page explaining a system (written in Perl I think) that was used to show a presentation to a number of different sites simultaneously (and synchronised). A presenter was at the main site and the browsers at 4 other remote sites would display the same page the presenter was viewing on his web browser as he went to various sites. I think it worked using multipart Content-type. Unfortunately I have lost the URL to the explanation of how it was done. On Saturday, 5 August 2000 8:48 AM Mr Bruce Christensen posted the following links explaining browser push; http://home.netscape.com/assist/net_sites/pushpull.html and; As for keeping the connection from timing out, see http://www.php.net/manual/function.set-time-limit.php. I have experimented with this but didn't get too far. I posted the following to the PHP list but didn't get any reply. I have tried the following script on WinNT5, Apache/1.3.13-dev, PHP Version 4.0.1pl2 and OpenBSD2.7 Apache/1.3.12, PHP Version 4.0.1pl2 (mod_php4) push.php; --8---snip---8--start ?php header("HTTP/1.0 200 OK"); header("Content-type: multipart/x-mixed-replace;boundary=ThisRandomString"); print("\n"); print( "--ThisRandomString\n"); print("Content-type: text/html\n"); print("\n"); print( "First update at "); echo date("H:i:s"); print("\n\n"); print( "--ThisRandomString\n"); flush(); sleep(5); print("Content-type: text/html\n"); print("\n"); print( "Second update at "); echo date("H:i:s"); print("\n\n"); print("--ThisRandomString--\n"); ? --8---snip---8--end On NT with the header("HTTP/1.0 200 OK"); statement I get an Apache error message; [Sun Aug 06 09:02:47 2000] [error] [client 192.168.0.60] malformed header from script. Bad header=HTTP/1.0 200 OK: f:/program files /novato/allcnet/php.exe I do not get this error on OpenBSD. I then removed the header("HTTP/1.0 200 OK"); statement and now NT and OpenBSD give the following output to the browser(IE5.0); (after a 5 second pause) --8---snip---8--start --ThisRandomString Content-type: text/html First update at 18:22:47 --ThisRandomString Content-type: text/html Second update at 18:22:52 --ThisRandomString --8---snip---8--end And the following output to the browser(Netscape 4.6); (after a 5 second pause) --8---snip---8--start Second update at 18:23:19 --8---snip---8--end ie With Netscape I never see the first update at ... part of the output as I would expect. I have also tried it with; header("Content-type: multipart/mixed;boundary=ThisRandomString"); but it makes no difference, the behaviour is identical. IE5 does not seem to understand multipart. The multipart mime boundary does not seem to be working properly in Netscape4.6. Regards Andrew Braund -Original Message- From: Greg Scott [mailto:[EMAIL PROTECTED]] Sent: Sunday, 25 March 2001 04:49 To: [EMAIL PROTECTED] Subject: Re: [PHP] Delaying Printed Output You might try using flush() after the prints. I tried that too, but at least in Netscape 6, it still waits until everything is done before displaying. I think Jack must be correct that this isn't possible for browser display. Thanks, Greg -- 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]
RE: [PHP] Directory Listing with PHP
You might like to try WebExplorer, may do what you want. http://suneworld.com/programs/ hth Regards Andrew Braund -Original Message- From: Chris Aitken [mailto:[EMAIL PROTECTED]] Sent: Thursday, 1 February 2001 15:35 To: PHP User Group Subject: [PHP] Directory Listing with PHP (Damn I hate it when I forget to change the subject) Does anyone have, or know of a script which simulates what Apache gives out when it shows the entire contents of a directory ? I find it very handy to use the directory listing of say graphics directories and the like, but I dont want others looking into them. What I thought would be a good system is to have an index.php file which asks for a password. If the password is accepted, it shoots them off to a php script which displays the contents of the DIR just as apache would. This way I can bar viewing of the directories contents, only viewable to the owners of the password. Ive seen a couple of scripts which claim to show the directory listing, but none of them seem to work any good with a decent layout and amount of file info. So im looking for a script which can display the listing properly. Does one exist, or am I just relieving myself into the wind ? Thanks Chris -- Chris Aitken - Webmaster/Database Designer - IDEAL Internet email: [EMAIL PROTECTED] phone: +61 2 4628 fax: +61 2 4628 8890 Unix -- because a computer's a terrible thing to waste! -- 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]