Re: [PHP] File Transfer from non-browser client using POST??
> If I wanted to use this utility to copy a file from a users (Windows) > workstation to my (Linux) webserver, how would I do this? The program on > the users workstation will create a file called "info.txt" and place it in > c:\wow. I want it to go to my server upload.mydomain.com. How do I get the > file c:\wow\info.txt from the user to my web server over https? > No solution here for the server side - I have a similar problem! But I DO know of a Win32 Borland library with an http component which supports POSTing of files. If you're working in Delphi, or C++ Builder, try http://www.nevrona.com/Indy/Download.html BUT - what about the server end, and PHP? I need to write a script which extracts the POSTed file content and store it on the server. (With a browser client I could upload from with form elements and use the PHP upload functions, but using a browser at the client end is not an option here.) According to the w3c docs, POSTed content is sent in the "request entity body". Since the request has a header, it's logical that it can have a body too :-) but I don't see any PHP functionality for getting at it. PHP itself must be able to extract the POSTed data - it does so when saving a POSTed file to its temporary location - but this function don't seem to be exposed in the API... is it? Thanks for any wisdom! Nik -- 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] Problem in sending mail with mail() function
Sigitas Paulavicius wrote: > "Vishak K Tomy" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello, > > I tried to send mail through the mail function but it is not > > working. I am using php version 3.0.12 under linux, following is the > > code I used to send mail. > > So what is the problem with it, any body please solve this. > > > > Regards > > Vishak > > Hi > > mail() uses the SMTP service running on localhost...errr... on the same > computer as the web service is running. So if there is no smtp service on > localhost, mail() won't work. > You must get SMTP libraray and use it to connect to some other server and > send the message. It's really simple and easy to come by. As far as I understand it, SMTP doesn't have to be on the same computer, but it's location does have to be configured right in php.ini or whatever. Check phpinfo() for PHP core configurations setting sendmail_path (Unix/Linux) or SMTP (Windows) - the SMTP value is the IP of an SMTP server. nik -- 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] Extracting the body of the http request entity? found it!
> > According to the w3c docs, POSTed content is sent in the "request > entity body". Since the request has a header, it's logical that it can > have a body too :-) but I don't see any PHP functionality for getting at > it. Someone in another group suggested accessing a variable called > $HTTP_RAW_POST_DATA, but that doesn't seem to exist when I POST data to > either of my test systems, which are Linux/Apache or Win98/PWS. > > PHP itself must be able to extract the POSTed data - it does so when > saving a POSTed file to its temporary location - but this function don't > seem to be exposed in the API... is it? Sorry to answer my own question! If you POST an html form with input elements, these are parsed by PHP into variables, and the data is discarded. BUT if you POST raw data from a generic http component, without sending name-value pairs, this data is exposed in $HTTP_RAW_POST_DATA. nik -- 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] Extracting the body of the http request entity? found it!
> I would like to add a note to this, that this works in general, but > the thing which actually triggers the setting of $HTTP_POST_RAW_DATA > is a not recognized mime-type. > Aha! Blinding light of understanding - THANKYOU! nik -- 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] Extracting the body of the http request entity?
I need to write a script which extracts information POSTed by a non-browser client, and stores it on the server. With a browser client I could upload from with form elements and use the PHP upload functions, but using a browser at the client end is not an option here. According to the w3c docs, POSTed content is sent in the "request entity body". Since the request has a header, it's logical that it can have a body too :-) but I don't see any PHP functionality for getting at it. Someone in another group suggested accessing a variable called $HTTP_RAW_POST_DATA, but that doesn't seem to exist when I POST data to either of my test systems, which are Linux/Apache or Win98/PWS. PHP itself must be able to extract the POSTed data - it does so when saving a POSTed file to its temporary location - but this function don't seem to be exposed in the API... is it? Thanks for any wisdom! nik -- 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] What's wrong with Apache + php + mysql on Windows?
> Hello, I can't understand the reason apache server running locally on my > Win98 machine delays so much to respond browser when accesing php > scripts in the form > > http://localhost/myscript.php > > When I transfer php scripts to host server via FTP, script execution is > immediate, even remote server being in another continent. > > I was running apache + php + mysql on Win95 and delay was terrible. Now > I moved to Win98 and delay became still worse. > > I know some parameter in httpd.conf or php.ini should be changed, but > how to kwow which parameter?. You could try tweaking the filesystem optimisiation in Control Panel > System > Performance. If your system is optimised for desktop use, it'll make an even more lousy server than Win9x usually does. :-) nik -- 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] include from another URL
Hi there, I'm new to these groups so forgive me if I'm asking at the wrong place (tell me where then :) Ok, I'm not PHP guru but I need to create a simple script that would do this: Include a content from another URL into the current output. I have done something like this: -- code start http://myotherurl.com:8080'; ?> -- code end and it seems to work with one exception: it produces a warning message saying something like "Warning: main(): stream does not support seeking in .../web-root/index.php on line 9" where line #9 is: include 'http://myotherurl.com:8080'; from above code. It then shows a message from 'http://myotherurl.com:8080' Thanks!!! Nik
[PHP] Include from another URL?
Hi there, I'm new to these groups so forgive me if I'm asking at the wrong place (tell me where then :) Ok, I'm not PHP guru but I need to create a simple script that would do this: Include a content from another URL into the current output. I have done something like this: -- code start http://myotherurl.com:8080'; ?> -- code end and it seems to work with one exception: it produces a warning message saying something like "Warning: main(): stream does not support seeking in .../web-root/index.php on line 9" where line #9 is: include 'http://myotherurl.com:8080'; from above code. It then shows a message from 'http://myotherurl.com:8080' Thanks!!! Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Include from another URL?
Great! Worked as expected. Thanks. Now it is time to ask how do I handle form (HTTP POST request) data into the URL. Can the same fopen() work as well? Thanks, Nik "Chris Boget" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Include a content from another URL into the current output. I have done > > something like this: > > Look into the fopen() function. I also believe that the file() function can > also take a URL, but I'm not sure. > > Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic link converter
On Thu, 2003-03-06 at 05:49, electroteque wrote: > hi there i am trying tom preg_replace on a string enclosed in brackets to > denote a dynamic link This works, if I understand you correctly: http://www.eletroteque.dyndns.org/index_html.php|Eletroteque Multimedia]"; echo $message = preg_replace( "/\[((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.]+)\|([\s\w\.]+)\b\]/i", "\\7", $message ); ?> But wouldn't it be easier just to do use a pattern like this "/\[([^|]+)\|([^\]]+)/" which gets everything between [ and | (the URI) and | and ] (the link name)? Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamic link converter
On Thu, 2003-03-06 at 05:49, electroteque wrote: > hi there i am trying tom preg_replace on a string enclosed in brackets to > denote a dynamic link This works, if I understand you correctly: http://www.eletroteque.dyndns.org/index_html.php|Eletroteque Multimedia]"; echo $message = preg_replace( "/\[((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.]+)\|([\s\w\.]+)\b\]/i", "\\7", $message ); ?> But wouldn't it be easier just to do use a pattern like this "/\[(.+)\|(.+)\]/" which gets everything between [ and | (the URI) and | and ] (the link name), and also looks pretty? Nik p.s. apologies for bodging the In-Reply-To -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I'm lost: text file upload
On Thu, 2003-03-06 at 15:33, John Taylor-Johnston wrote: > I'm looking for a couple of lines of code so I can upload the contents of a *.txt > into a buffer and declare it as a string so I can spit it back in a . I > don't want to necessarily upload a text file, only load it into a buffer. > > I'm lost Will this do? $fh=fopen($_FILES['userfile']['tmp_name'], 'r'); $fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name'])); fclose($fh); Assuming your form looked like this: Read this file: You can view this in action at http://nikmakepeace.com/goodies/upload-string.php Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include or function
On Fri, 2003-03-07 at 09:34, John Taylor-Johnston wrote: > I have an *.inc with html, a rather long list of . And you want to print out said list of OPTIONs several times with different ones selected each time? You could do it with an array and a function. The array would contain a list of keys and data (e.g. array ("key" => "data")) where the keys would be the values for the option elements, and the data would be the labels (i.e. what's between the option start tag and end tag). The function would build the select by looping through the array and printing out the option elements. By comparing each key with a parameter you passed in to the function, it would know which option element to give the selected attribute to. Give it a try, and if you have any difficulty, look at: http://nikmakepeace.com/goodies/help/selectbuilder.php (.phps available) Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload and permissions
On Fri, 2003-03-07 at 07:24, Charles Kline wrote: > I have played with it - changing permissions and the only > one that works is chmod 777 - not sure if this is good or not - pretty > new to unix administration stuff. If you don't want to make a new directory to store them, you should make sure that uploaded files have their permissions changed by php so that only the web server can read them. You could in addition have php create the directory in which you want to store them, so that it has total control of the directory's permissions. I did this with my website so that other users of the machine can't even see what's in the directories in which my users store images. They might be private after all, who am I to say? Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Memory errors?
On Fri, 2003-03-07 at 14:44, Leif K-Brooks wrote: > Lately, I've been getting the following error: > Fatal error: Allowed memory size of 15728640 bytes exhausted (tried to > allocate 86460 bytes) in Unknown on line 0 > The thing is, I'm not doing anything that could possibly require much > memory. Is there some kind of bug, or am I missing something? Are you sure you don't have an infinite loop anywhere? This sort of thing can happen if you have an array or a string being built by a loop that never quits. Nik -- http://travelog.uberblog.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying few words from record in mySQL
On Sat, 2003-03-08 at 05:21, Rahul.Brenda wrote: > Kevin, > > Your program certainly makes very good sense to me. I have written an extension of the idea available at http://nikmakepeace.com/goodies/abbreviate.phps It takes 5 arguments: string to be abbreviated, length in characters to abbreviate to (-ve values mean reduce string by this many chars) place you want to abbreviate at (end, start or middle), string used to abbreviate (included in the total length) (default is "..." html entity) whether to enclose the abbreviation in the element (title includes the whole string for mouseover) I hope you or anyone else likes it. Maybe some day I'll actually do some proper work instead of writing silly utilities. Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Member function as error_handler
Query One: Can I use a member function of an object as an error_handler? I currently declare a function for error handling with every page, but I would like to put it in an object which lives in the session anyway. The problem is I can't seem to do it; when I try to set the error handler to a method, it defaults to PHP's usual methods. Is it me or PHP? MTIA, Nik -- http://travelog.uberblog.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Syntax query
Can anyone tell me why this doesn't work: $db_object = pg_fetch_object($this->getLastResult()); In imaginary interactive mode, it works like this: ME > echo $this->getLastResult(); PHP> Resource id #67 ME > echo $this->mr_lastResult; PHP> Resource id #67 ME > echo pg_fetch_object($this->getLastResult()); PHP> ME > echo pg_fetch_object($this->mr_lastResult); PHP> Any ideas? Nik -- http://travelog.uberblog.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Member function as error_handler
On Mon, 2003-03-10 at 02:40, David Eisenhart wrote: > I'd recommend that you consider using the set_error_handler function Of course, this is what I am doing. My question is can I use a member function of an object as an error handler? I don't seem to be able to, but I might have overlooked something. Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax query
On Mon, 2003-03-10 at 03:01, Ernest E Vogelsinger wrote: > At 13:38 09.03.2003, Nik Makepeace said: > [snip] > >Can anyone tell me why this doesn't work: > > > >$db_object = pg_fetch_object($this->getLastResult()); > > pg_fetch_object() returns an object with properties that correspond to the > fetched row. It returns FALSE if there are no more rows or error. Yes, the error was indeed between the chair and keyboard. In fact I had (while curious) lazily wrapped all queries in "begin" and "commit" and this was causing the problem - the last result was the result of the commit, not the select. Thanks anyway. Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] closing a browser-window with php
hi news group my first post, so please be gentle ;-) my problem is that i have to open a browser page of specific size and coordinates from a macromedia director movie. but: the only call i can send from there is for a browser window without any attributes (so i can't control size or location). can i use php to call a webpage that calls a php script and immediately (without user interaction such as confirming a dialoguebox) opens the 'actual' browser window at the correct location and the right size? thanks in advanced for your help!! nik crosina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Spell checker?
Hi, I have a site which will be updated periodically by someone else, so have made some forms with textareas for them to upload the text into the MySQL database. I was wondering if there is a PHP function/class which could spell check these forms? TTFN Nik -- 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] Profanity Filter
In article <94adfp$5le$[EMAIL PROTECTED]>, Stephan Ahonen <[EMAIL PROTECTED]> wrote: > I'd make it an array: > $filter = array(moron, idiot, pratt); > foreach($filter as $badword) { > if (strstr($name, $badword)) { > do this if it contains one of the bad words > } > else { > do this if it doesn't > } > } But wouldn't this approach have its drawbacks, too? For example, I live in Kiel, Germany, about 20km from a town called Wankendorf. Presumably I wouldnÄt be able to say this. Nik -- 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] Spell checker?
In article <[EMAIL PROTECTED]>, Brandon Orther <[EMAIL PROTECTED]> wrote: > Check here, I have never messed with it just ran into it the other day. > I hope it helps. > http://www.php.net/manual/en/ref.pspell.php Sort of. Thanks go to Kristi as well for spotting this, PHP has so many bult in functions already! The only problem is that the site host doesn't have this functionality installed, and as its a free host, I won't bother asking them. What I will probably have to do is make my own function/class using a great big list of words. Does anyone know where I could find a text list of every word in the English language ;-) Thanks, Nik -- 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 do you erase quotes from variable?
In article <a05001900b69508a9435a@[38.241.81.150]>, Michael Zornek <[EMAIL PROTECTED]> wrote: > I have a variable(s) that hold the string: > "name" > and I'd like to kill the quotes so it contains: > name $name = ereg_replace("\"","",$name); Maybe, Nik -- -- 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] FAQ
In article <[EMAIL PROTECTED]>, Rick St Jean <[EMAIL PROTECTED]> wrote: > The problem is that people are lazy or just to stupid to look for > stuff. I guess people are either too lazy or just too stupid to learn how to quote in emails. ;-) > I guess I am frustrated because all the lists I am on are filled with > lazy people who whine and want someone else to do all their work for > them. I get frustrated by people sending huge quotes, and leaving 4 of those auto generated list tags behind. If they didn't, the traffic on the list, size wise, would be halved. Nik -- 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] XML Newbie.!
In article <[EMAIL PROTECTED]>, Diego Fulgueira <[EMAIL PROTECTED]> wrote: > Hi! Ok, this is not a question about PHP, but since this is such a > great discussion forum, I am certain it is a good place to get started > with a new technology. Oh, but it is a PHP mail list/newsgroup. This question does not belong here. Nik -- 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] XML Newbie.!
In article <[EMAIL PROTECTED]>, Rick St Jean <[EMAIL PROTECTED]> wrote: > Make sure you read the whole message before you comment. There was a > relative question at the bottom. I have a question concerning tags. I also have a question concerning PHP. Should I ask both questions here, or just the PHP related question? Nik btw, the references, ie who you are replying to, in your mail is incorrect. -- 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] PHP Book?
Hey everyone... I've been programming in perl for about 3 years now, i have installed php and have been working on it for about three weeks. I started by converting some of the programs I've written in Perl to PHP it seems its pretty similar to Perl and not very hard to learn for a perl programmer... but i need some reference book with some practical examples so i could work with... and probably something that gives me ideas on different types of programs and things that i could do in PHP... something that covers everything in PHP... and is NOT copied from the manual! :)) I am sure most of you in this group have got some sort of a PHP book... can you please tell me out of your experience which ones are good for me to buy? Regards Hamed Nik -- 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] preg_split
I have the following code with a rather odd behaviour: Test> Hopefully it gets done here I would like that very much but whether it will happen or not is difficult to say.'; $Xarray=preg_split('/(?=)/',$string,-1, 'SPLIT_DELIM_CAPTURE'); $count=count($Xarray); for ($i=0;$i < $count;){ print $Xarray[$i]; //print $i; $i++; } ?> The behaviour is that on the last '' delimiter that is supposed to be returned instead returns 'p>', leaving of the first '<'. Below is the source: Test> This is some text which will eventually need to be split Hopefully it gets done here I would like that very much but whether it will happen or not p>is difficult to say. This was done as a test to figure out what was going on. I am probably making some stupid newbie mistake, but I have no idea what it is. Any ideas? Best, Nik __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php