[PHP] Re: Taking body of an email and storing it in MySQL database
Hello, on 09/07/2009 07:47 AM Dave M G said the following: > I am working on a project now where I need to check a POP3 mail account, > download any mails there, and store the body and headers of each > individual mail as plain text in a MySQL database. > > I have downloaded the POP3 class which seems to be the standard class > everyone uses for POP3 mail checking: > http://www.phpclasses.org/browse/package/2.html > > I think I understand how to create an instance of the class and use it > to check the email. The part where you log into the account isn't that > complicated. > > But after that it becomes a little strange. It seems that emails are not > mere text files, but have to be assembled line by line? > > I thought each email, and their headers, would be something I could just > access, download, and pass along to MySQL. But it seems more complicated > than that. > > Has anyone done something like this before? > > If someone could let me know how it is that I can create a body of text > for each email (including the headers) so that I can then store it in > the database, that would be awesome. If you look at that same package there is a script named browse_mailbox.php that demonstrates how to use the POP3 class to pull messages from the POP3 server and automatically decode them so you can process the messages very easily according to your needs. It returns arrays that list all message parts, including any attachments. From then on, you need to decide which parts of the messages are relevant to you to perform the necessary database INSERT queries to store the message text, HTML, images, attachments, etc.. For this you also need the MIME parser class that is available in the same site: http://www.phpclasses.org/mimeparser You may also want to read this blog post to learn how to use these classes to process the messages conveniently: http://www.phpclasses.org/blog/package/2/post/1-Process-incoming-email-messages-using-PHP.html -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to take output from an include, and embed it into a variable?
On Tue, Sep 8, 2009 at 12:35 AM, Rob Gould wrote: > I have an invoice table that is drawn on a number of pages, so I have all > the logic in an include-file like this: > > include "invoicetable_bottom.php"; > > > However, now I'm needing to take the output from that include file and pass > it as an email. To do that, I need to somehow take the output from this > include file and get it into a variable somehow. Is there a simple way to > do this? > > Something like: $emailtcontent = include "invoicetable_bottom.php"? > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Use output buffering and capture: http://us3.php.net/manual/en/book.outcontrol.php ob_start(); include 'stuff_that_makes_html.php'; $contents = ob_get_clean(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to take output from an include, and embed it into a variable?
I have an invoice table that is drawn on a number of pages, so I have all the logic in an include-file like this: include "invoicetable_bottom.php"; However, now I'm needing to take the output from that include file and pass it as an email. To do that, I need to somehow take the output from this include file and get it into a variable somehow. Is there a simple way to do this? Something like: $emailtcontent = include "invoicetable_bottom.php"? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calendar tutorial
On Tue, Sep 8, 2009 at 9:17 AM, Haig Davis wrote: > Dear PHP List Members, > least get me started) that will allow me to schedule various multi day > events and write the requests to a mySQL database. I would prefer something > that is PHP/ mySQL, HTML and CSS no flash or Java. If any one knows of a > site on the web I could find such a tutorial please let me know. i have googled a lot to find out a good tutorial on this topic, finally decided to start coding it. it's just a bunch of while loops and mysql views. the schema and the classes and methods are totally up to the developer and heavily depends on the specific requirements. date_parse and strtotime were very useful php functions. ~viraj > > Many Thanks > > Haig Vancouver BC > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need php_mssql so I retreated to 5.2.10
under IE8: http:// 209.33.25.167:8080/phpinfo.php with: I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. under Firefox 3.5.2 ___ The specified procedure could not be found. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = "C:\PHP\ext" (not trying to use any extension ...just get phpinfo to work) doc_root = "C:\inetpub\wwwroot" // for IIS/PWS an earlier post recommended: doc_root = _ IIS 5.1 properties->configuration I added .php C:\PHP\php5.dll GET,HEAD,POST,DEBUG _ I added to the XP Prof environment path ;C:\PHP;C:\PHP\ext I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext _ From the unzipped download, I copied ntwdblib.dll to C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I never found any statement of the necessity of requiring CGI The instructions ramble around -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar tutorial
Dear PHP List Members, First off I am well aware that I can go online and download a PHP script to make a Calendar, it's not that I'm too cheap to buy the script it is that I want to work through and fully understand what I have so that I am intimately aware of every aspect of my project. What I really would like is a tutorial that will teach me to write the script for a calendar (or at least get me started) that will allow me to schedule various multi day events and write the requests to a mySQL database. I would prefer something that is PHP/ mySQL, HTML and CSS no flash or Java. If any one knows of a site on the web I could find such a tutorial please let me know. Many Thanks Haig Vancouver BC
[PHP] new php script and sqlite
Hi, I'm currently using a text file to store data which the php script will read and write back to. I've a few questions: 1) I'm thinking of using sqlite, but not sure whether this will be widely available on most hosts, as I intend for the php script to be deployed without needing to much with much configuration. Is sqlite included with most php setups? 2) Should I be using sqlite 2 or 3? Thanks for your time! Regards. Eric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Taking body of an email and storing it in MySQL database
Paul, Thank you very much for responding. > I'm not sure why you're attempting to do the above. According to the > documentation, you should simply be able to do > ... > $pop3->save2mysql(a bunch of parameters); I'm not sure the parameters on the save2mysql() function give me the flexibility I need. I have to save to particular tables and change other fields in the database, determined by user data in the database and the from and subject field in the email. The save2mysql class seems to assume a certain database structure. Although, again, I could be wrong about that because documentation is lacking. > However, you could set up a loop > like this: > > for ($j = 0; $j < count($msg); $j++) { > if (strpos($msg[$i], 'Subject: ') == 0) > // got the subject line > if (strpos($msg[$i], 'From: ') == 0) > // got the From: address line > } > > Parsing the subject line and From: address is up to you. But there are > plenty of PHP functions to search and parse strings. Thanks very much for the code you provided. I think that should be enough of a boost forward to get me to a new stage, and hopefully even take me to the end of this current problem. I'll see what I can do with it and then hopefully report back success. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to check function's execution?
Your dbupdate is probably executing a mysql_query command. Is so, update results from mysql_query will be either true on success or false on failure. If your query also fails due to perms it will return false. --Original Message-- From: A.a.k To: php-general@lists.php.net ReplyTo: A.a.k Subject: [PHP] how to check function's execution? Sent: Sep 7, 2009 2:52 PM hello I have a problem to check whether a function successfully inject to database or not, here is the code : if($object->dbupdate()) echo 'done'; else echo 'damn!'; inside the 'if' statement $obj->dbupdate() doesn't execute , how can I execute and check if it was a successful inject within this function? is it even possible or should I check within class or something? -- 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
[PHP] how to check function's execution?
hello I have a problem to check whether a function successfully inject to database or not, here is the code : if($object->dbupdate()) echo 'done'; else echo 'damn!'; inside the 'if' statement $obj->dbupdate() doesn't execute , how can I execute and check if it was a successful inject within this function? is it even possible or should I check within class or something? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overwrite value of true or false in PHP
I see what's going on now. Because of the type conversion, I am writing my code such that my return codes are translated to a strict 1 or 0. The idea of having anything other than '' or 0 translating to a true scares me a little but thanks for pointing out the === operator. I had to rewrite a lot of code after discovering it. Good times... Thanks for clarifying everyone. -Original Message- From: Martin Scotta Date: Mon, 7 Sep 2009 16:43:59 To: Cc: Subject: Re: [PHP] Overwrite value of true or false in PHP On Mon, Sep 7, 2009 at 4:14 PM, Bobby Pejman wrote: > Hi, > > I noticed that the following returns a 1. > > echo (1<2) ? True : False > > I was under the impression that true/false are of type boolean and not int. > But in php anything other than 0 translates to true, meaning a 1. What I > am trying to achieve is for a 1 to be a 1 and a true or false to be a true > and false respectively and I do not want to put quotes around the word > true/false either because then it is no longer a boolean but string. > > Is it possible to overwrite php's true/false and declare them as boolean? > You often see in C++, some use Define(). > > Thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Yes *true* and *false* are booleans. PHP convert natively different types to boolean in order to help write sentences like this if( $object ) { $object->something(); } while( $data = mysql_fetch_assoc( $resource ) ) { print_r( $data ); } But we you try to print a boolean variable PHP convert it to string: true becomes '1' and false becomes ''. That's why you can't just echo a boolean variable to see the value, but you can rely on var_dump to show this. $bool = true; echo $bool; var_dump( $bool ); $bool =! $bool; echo $bool; var_dump( $bool ); As other languages PHP as an special operator for checking types while comparing values. $a = 'false'; $b = true; var_dump( $a == $b, # <-- true $a === $b # <-- false ); This happens because values are converted before comparison so, 'false' becomes true. PHP converts everything different to an empty string as *true* This also affect any type of variable. -- Martin Scotta
Re: [PHP] Taking body of an email and storing it in MySQL database
On Tue, Sep 08, 2009 at 03:27:05AM +0900, Dave M G wrote: > Paul, > > Is there a decent tutorial anywhere on the net for the pop3.class.inc > available on phpclasses.org? > > http://www.phpclasses.org/browse/package/1120.html > > Maybe I'm blind, but I just can't find anywhere a decent description or > tutorial of what calls you can make to its functions. The documentation > file has two sections in German and a terse section in English. > > I'm trying to figure out how to get each message and get their subject > line, from address, and then based on those two pieces of information, > I'll take the whole body and store them in the right place in a MySQL > database. > > Just for reference, this is what I've built so far (I renamed > pop3.class.inc to POP3.php): > > include('POP3.php'); > $pop3 = new POP3(); > > // Connect to mail server > $do = $pop3->connect ('xxx.x.com'); > if ($do == false) > { > $message = $pop3->error; > } > > $do = $pop3->login ('uuu', 'ppp'); > > if ($do == false) > { > $message = $pop3->error; > } > > $status = $pop3->get_office_status(); > > if ($status == false) > { > die($pop3->error); > } > > $count = $status['count_mails']; > > > for ($i = 1; $i <= $count; $i++) > { > // Here's where I hit a wall. > // 1. Get the from address > // 2. Get the subject line > // 3. Get the header+body as one text file > // 4. Store it in the database. I'm not sure why you're attempting to do the above. According to the documentation, you should simply be able to do: for ($i = 1; $i <= $count; $i++) { $msg = $pop3->get_mail($i); // parse the message as you like $pop3->save2file($msg, 'myfilename.txt'); // or $pop3->save2mysql(a bunch of parameters); } The $msg is returned as an array of strings. You could use the PHP implode() function to reconstruct the array as a single string. But the POP3::save2file() function will do this and save it to a text file if you like. It appears the class doesn't provide any support for parsing the message internally. So that part is up to you. However, you could set up a loop like this: for ($j = 0; $j < count($msg); $j++) { if (strpos($msg[$i], 'Subject: ') == 0) // got the subject line if (strpos($msg[$i], 'From: ') == 0) // got the From: address line } Parsing the subject line and From: address is up to you. But there are plenty of PHP functions to search and parse strings. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overwrite value of true or false in PHP
On Mon, Sep 7, 2009 at 3:14 PM, Bobby Pejman wrote: > Hi, > > I noticed that the following returns a 1. > > echo (1<2) ? True : False > > I was under the impression that true/false are of type boolean and not int. > But in php anything other than 0 translates to true, meaning a 1. What I am > trying to achieve is for a 1 to be a 1 and a true or false to be a true and > false respectively and I do not want to put quotes around the word true/false > either because then it is no longer a boolean but string. > > Is it possible to overwrite php's true/false and declare them as boolean? > You often see in C++, some use Define(). > > Thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > It might be pertinent for you to read the section of the manual dealing with type juggling: http://us3.php.net/manual/en/language.types.type-juggling.php and the various things linked therein. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overwrite value of true or false in PHP
On Mon, Sep 7, 2009 at 4:19 PM, Ashley Sheridan wrote: > On Mon, 2009-09-07 at 19:14 +, Bobby Pejman wrote: > > Hi, > > > > I noticed that the following returns a 1. > > > > echo (1<2) ? True : False > > > > I was under the impression that true/false are of type boolean and not > int. But in php anything other than 0 translates to true, meaning a 1. > What I am trying to achieve is for a 1 to be a 1 and a true or false to be > a true and false respectively and I do not want to put quotes around the > word true/false either because then it is no longer a boolean but string. > > > > Is it possible to overwrite php's true/false and declare them as boolean? > You often see in C++, some use Define(). > > > > Thanks. > > > The statement you gave does return a boolean value, but what you are > doing is printing the resulting value out. PHP converts the boolean to > the nearest printable value, which will be a 1 or 0. If you want it to > output the value 'True' or 'False' then you need to output a string > value. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I think php convert the boolean variable to string before print its content. That's why... echo true; # prints '1' echo false; # does not prints anything, or prints '' $bool = false; var_dump( (string) $bool, (int) $bool ); -- Martin Scotta
Re: [PHP] Displaying image paths with spaces
HallMarc Websites wrote: Actually, %5C is a \ character, % is %25 Why it is adding a character that is used in local address strings is baffling and I think a clue as to what is going on. Is it possible it is mashing a local file address into a web address? Aha! I think that might be it. In the database it is stored as src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg" But somehow it is converting this to a local file address before it is displayed. BTW, IMHO using spaces in folder and/or file names is bad practice and should be avoided. I totally agree and the code I write I always replace user's spaces with '_' characters, but this is FCKeditor's directory creation code. Maybe I should look into modifying it to do the same. I actually have already modified FCK to store images in client specific directories and found the code to be pretty well written so maybe I need to do the same and solve the problem that way. I'll check that out. Thanks Ash and Marc for the input. I think we're on the right path ;) Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overwrite value of true or false in PHP
On Mon, Sep 7, 2009 at 4:14 PM, Bobby Pejman wrote: > Hi, > > I noticed that the following returns a 1. > > echo (1<2) ? True : False > > I was under the impression that true/false are of type boolean and not int. > But in php anything other than 0 translates to true, meaning a 1. What I > am trying to achieve is for a 1 to be a 1 and a true or false to be a true > and false respectively and I do not want to put quotes around the word > true/false either because then it is no longer a boolean but string. > > Is it possible to overwrite php's true/false and declare them as boolean? > You often see in C++, some use Define(). > > Thanks. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Yes *true* and *false* are booleans. PHP convert natively different types to boolean in order to help write sentences like this if( $object ) { $object->something(); } while( $data = mysql_fetch_assoc( $resource ) ) { print_r( $data ); } But we you try to print a boolean variable PHP convert it to string: true becomes '1' and false becomes ''. That's why you can't just echo a boolean variable to see the value, but you can rely on var_dump to show this. $bool = true; echo $bool; var_dump( $bool ); $bool =! $bool; echo $bool; var_dump( $bool ); As other languages PHP as an special operator for checking types while comparing values. $a = 'false'; $b = true; var_dump( $a == $b, # <-- true $a === $b # <-- false ); This happens because values are converted before comparison so, 'false' becomes true. PHP converts everything different to an empty string as *true* This also affect any type of variable. -- Martin Scotta
RE: [PHP] Displaying image paths with spaces
> -Original Message- > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] > Sent: Monday, September 07, 2009 1:24 PM > To: Skip Evans > Cc: php-general@lists.php.net > Subject: Re: [PHP] Displaying image paths with spaces > > On Mon, 2009-09-07 at 12:14 -0500, Skip Evans wrote: > > Ashley Sheridan wrote: > > > > > > How are you outputting those URLs? PHP won't just automatically > converty > > > '%20' to a '\ '. > > > > > > What is the raw URL format you're getting from FCKEditor? > > > > > > Thanks, > > > Ash > > > http://www.ashleysheridan.co.uk > > > > > > > The raw code in the FCKeditor looks like this: > > > > > src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1comp > ressed.jpg" > > > > (withing an tag of course) > > > > But when the page displays and the images do not appear, > > viewing the image's properties shows this: (Notice the %5C). > > That %5C is what I think is being converted to a slash. Why it > > shows up is baffling me. > > > > > http://penguinsites.com/clients/client_118/images//Event%5C%20images/Sh > ow%5C%20ads/catspaw1compressed.jpg > > > > I simply output the code from the FCKeditor with a plain echo > > to the browser. > > > > But then if I right-click the image to view it, that's when I > > see this > > > > The requested URL /clients/client_118/images//Event\ > > images/Show\ ads/catspaw1compressed.jpg was not found on this > > server. > > > > So it seems it's not preserving the %20 as coded spaces, and > > also converting that %5C to a slash! > > > > Wh > > > > Thanks, > > Skip > > > > -- > > > > Skip Evans > > Big Sky Penguin, LLC > > 503 S Baldwin St, #1 > > Madison WI 53703 > > 608.250.2720 > > http://bigskypenguin.com > > > > Those of you who believe in > > telekinesis, raise my hand. > > -- Kurt Vonnegut > > > I believe %5C is the http code for %. > > Are you saying then that FCKEditor is sending the %20 encoded URL when > you submit the form? I've not had any problems using FCKEditor myself. > Have you tried using str_replace('%20', ' ', $url) on the URL when you > receive it from the form? > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Actually, %5C is a \ character, % is %25 Why it is adding a character that is used in local address strings is baffling and I think a clue as to what is going on. Is it possible it is mashing a local file address into a web address? BTW, IMHO using spaces in folder and/or file names is bad practice and should be avoided. Marc Hall HallMarc Websites 610.446.3346 __ Information from ESET Smart Security, version of virus signature database 4403 (20090907) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Overwrite value of true or false in PHP
On Mon, 2009-09-07 at 19:14 +, Bobby Pejman wrote: > Hi, > > I noticed that the following returns a 1. > > echo (1<2) ? True : False > > I was under the impression that true/false are of type boolean and not int. > But in php anything other than 0 translates to true, meaning a 1. What I am > trying to achieve is for a 1 to be a 1 and a true or false to be a true and > false respectively and I do not want to put quotes around the word true/false > either because then it is no longer a boolean but string. > > Is it possible to overwrite php's true/false and declare them as boolean? > You often see in C++, some use Define(). > > Thanks. > The statement you gave does return a boolean value, but what you are doing is printing the resulting value out. PHP converts the boolean to the nearest printable value, which will be a 1 or 0. If you want it to output the value 'True' or 'False' then you need to output a string value. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Overwrite value of true or false in PHP
Hi, I noticed that the following returns a 1. echo (1<2) ? True : False I was under the impression that true/false are of type boolean and not int. But in php anything other than 0 translates to true, meaning a 1. What I am trying to achieve is for a 1 to be a 1 and a true or false to be a true and false respectively and I do not want to put quotes around the word true/false either because then it is no longer a boolean but string. Is it possible to overwrite php's true/false and declare them as boolean? You often see in C++, some use Define(). Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Taking body of an email and storing it in MySQL database
Paul, Is there a decent tutorial anywhere on the net for the pop3.class.inc available on phpclasses.org? http://www.phpclasses.org/browse/package/1120.html Maybe I'm blind, but I just can't find anywhere a decent description or tutorial of what calls you can make to its functions. The documentation file has two sections in German and a terse section in English. I'm trying to figure out how to get each message and get their subject line, from address, and then based on those two pieces of information, I'll take the whole body and store them in the right place in a MySQL database. Just for reference, this is what I've built so far (I renamed pop3.class.inc to POP3.php): include('POP3.php'); $pop3 = new POP3(); // Connect to mail server $do = $pop3->connect ('xxx.x.com'); if ($do == false) { $message = $pop3->error; } $do = $pop3->login ('uuu', 'ppp'); if ($do == false) { $message = $pop3->error; } $status = $pop3->get_office_status(); if ($status == false) { die($pop3->error); } $count = $status['count_mails']; for ($i = 1; $i <= $count; $i++) { // Here's where I hit a wall. // 1. Get the from address // 2. Get the subject line // 3. Get the header+body as one text file // 4. Store it in the database. } $pop3->close(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying image paths with spaces
On Mon, 2009-09-07 at 12:14 -0500, Skip Evans wrote: > Ashley Sheridan wrote: > > > > How are you outputting those URLs? PHP won't just automatically converty > > '%20' to a '\ '. > > > > What is the raw URL format you're getting from FCKEditor? > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > The raw code in the FCKeditor looks like this: > > src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg" > > (withing an tag of course) > > But when the page displays and the images do not appear, > viewing the image's properties shows this: (Notice the %5C). > That %5C is what I think is being converted to a slash. Why it > shows up is baffling me. > > http://penguinsites.com/clients/client_118/images//Event%5C%20images/Show%5C%20ads/catspaw1compressed.jpg > > I simply output the code from the FCKeditor with a plain echo > to the browser. > > But then if I right-click the image to view it, that's when I > see this > > The requested URL /clients/client_118/images//Event\ > images/Show\ ads/catspaw1compressed.jpg was not found on this > server. > > So it seems it's not preserving the %20 as coded spaces, and > also converting that %5C to a slash! > > Wh > > Thanks, > Skip > > -- > > Skip Evans > Big Sky Penguin, LLC > 503 S Baldwin St, #1 > Madison WI 53703 > 608.250.2720 > http://bigskypenguin.com > > Those of you who believe in > telekinesis, raise my hand. > -- Kurt Vonnegut > I believe %5C is the http code for %. Are you saying then that FCKEditor is sending the %20 encoded URL when you submit the form? I've not had any problems using FCKEditor myself. Have you tried using str_replace('%20', ' ', $url) on the URL when you receive it from the form? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying image paths with spaces
Ashley Sheridan wrote: How are you outputting those URLs? PHP won't just automatically converty '%20' to a '\ '. What is the raw URL format you're getting from FCKEditor? Thanks, Ash http://www.ashleysheridan.co.uk The raw code in the FCKeditor looks like this: src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg" (withing an tag of course) But when the page displays and the images do not appear, viewing the image's properties shows this: (Notice the %5C). That %5C is what I think is being converted to a slash. Why it shows up is baffling me. http://penguinsites.com/clients/client_118/images//Event%5C%20images/Show%5C%20ads/catspaw1compressed.jpg I simply output the code from the FCKeditor with a plain echo to the browser. But then if I right-click the image to view it, that's when I see this The requested URL /clients/client_118/images//Event\ images/Show\ ads/catspaw1compressed.jpg was not found on this server. So it seems it's not preserving the %20 as coded spaces, and also converting that %5C to a slash! Wh Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encrypt then decrypt yields extra dots at end
I thought this code: $enc=mcrypt_ecb(MCRYPT_RIJNDAEL_256,"salt123","encrypt_me",MCRYPT_ENCRYPT); $dec=mcrypt_ecb(MCRYPT_RIJNDAEL_256,"salt123",$enc,MCRYPT_DECRYPT); echo $dec; would yield "encrypt_me". The actual result is "encrypt_me.." (bunch of extra dots). Why, and how do I fix it? Does it have something to do w/ the warning I get: Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty IV, which is NOT recommend I assumed that was a security warning, not a functionality warnings? -- We're just a Bunch Of Regular Guys, a collective group that's trying to understand and assimilate technology. We feel that resistance to new ideas and technology is unwise and ultimately futile. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Taking body of an email and storing it in MySQL database
On Mon, Sep 07, 2009 at 07:47:00PM +0900, Dave M G wrote: > PHP List, > > I am working on a project now where I need to check a POP3 mail account, > download any mails there, and store the body and headers of each > individual mail as plain text in a MySQL database. > > I have downloaded the POP3 class which seems to be the standard class > everyone uses for POP3 mail checking: > http://www.phpclasses.org/browse/package/2.html > > I think I understand how to create an instance of the class and use it > to check the email. The part where you log into the account isn't that > complicated. > > But after that it becomes a little strange. It seems that emails are not > mere text files, but have to be assembled line by line? > > I thought each email, and their headers, would be something I could just > access, download, and pass along to MySQL. But it seems more complicated > than that. > > Has anyone done something like this before? > > If someone could let me know how it is that I can create a body of text > for each email (including the headers) so that I can then store it in > the database, that would be awesome. I don't know what your class is doing, but yes, emails are very simple in structure. Everything above the first bare newline (nothing else on that line) is header, and everything below it is body. Even mime-encoded attachments are just part of the body and can be stored as plain text. Your class may be parsing the emails and assigning various parts of them to various class members. But emails are downloaded as a stream of bits, sequentially, top to bottom. Somewhere in the class is a routine which is sucking up that bit stream. At that point, you can capture it without other parsing. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return XML attribute in DOM
Doesn't the DOM have the getAttribute() method? Thanks, Ash http://www.ashleysheridan.co.uk It's not in my reference, though I see it in the PHP manual now. This is what I have: _ $dom = new DomDocument(); $dom -> load("items.xml"); $topics = $dom -> getElementsByTagName("item"); echo(""); foreach ($topics as $node ) { echo("". $node -> hasAttributes() .""); } echo(""); __ I'm replacing hasAttributes() with getAttribute() but its throwing me an error, I'm probably using it incorrectly. I think I'm drowning in the deep end =/ Could you advise Gamesmaster ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Return XML attribute in DOM
On Mon, 2009-09-07 at 16:37 +0100, Matthew Croud wrote: > > I'm at my wits end here, so close to the finishing line! > > Is there a method to return an attribute value of an XML node using > DOM, I can check to see if an attribute exists using hasAttributes() > But I can't retrieve the value. > > I'm so desperate i've started to eat dirt. > > Many thanks, > Matt Doesn't the DOM have the getAttribute() method? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Return XML attribute in DOM
I'm at my wits end here, so close to the finishing line! Is there a method to return an attribute value of an XML node using DOM, I can check to see if an attribute exists using hasAttributes() But I can't retrieve the value. I'm so desperate i've started to eat dirt. Many thanks, Matt
RE: [PHP] Taking body of an email and storing it in MySQL database
>-Original Message- >From: Dave M G [mailto:mar...@autotelic.com] >Sent: 07 September 2009 14:26 >To: Richard Heyes >Cc: php-general@lists.php.net >Subject: Re: [PHP] Taking body of an email and storing it in MySQL database > >Richard, > >Thank you for responding. > >> Sounds like you may have a MIME (an HTML email or one with attachments >> etc) email to decode. > >No, the mails should be in plain text format. > I probably didn't describe my issue properly because I don't understand it fully. > >If I can assume all the mails I am receiving are in plain text format - >which they should be because it is within a controlled environment - can >I use PHP to pull out each email from the POP server essentially as a >text file? > >I need to find out the sender and subject line, but other than that, the >rest of it (including headers) I just want to store in MySQL. Dave, Take a look on phpclasses.net, they have classes which connect via POP3 and give you arrays of messages back. HTH J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Taking body of an email and storing it in MySQL database
Richard, Thank you for responding. > Sounds like you may have a MIME (an HTML email or one with attachments > etc) email to decode. No, the mails should be in plain text format. I probably didn't describe my issue properly because I don't understand it fully. If I can assume all the mails I am receiving are in plain text format - which they should be because it is within a controlled environment - can I use PHP to pull out each email from the POP server essentially as a text file? I need to find out the sender and subject line, but other than that, the rest of it (including headers) I just want to store in MySQL. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Taking body of an email and storing it in MySQL database
Hi, > ... Sounds like you may have a MIME (an HTML email or one with attachments etc) email to decode. What you can do is use the PEAR class Mail_mimeDecode ( http://pear.php.net/package/Mail_mimeDecode ). Pass it the entire email (headers and all) and it will try to decode it for you. -- Richard Heyes HTML5 graphing: RGraph - www.rgraph.net (updated 5th September) Lots of PHP and Javascript code - http://www.phpguru.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Taking body of an email and storing it in MySQL database
PHP List, I am working on a project now where I need to check a POP3 mail account, download any mails there, and store the body and headers of each individual mail as plain text in a MySQL database. I have downloaded the POP3 class which seems to be the standard class everyone uses for POP3 mail checking: http://www.phpclasses.org/browse/package/2.html I think I understand how to create an instance of the class and use it to check the email. The part where you log into the account isn't that complicated. But after that it becomes a little strange. It seems that emails are not mere text files, but have to be assembled line by line? I thought each email, and their headers, would be something I could just access, download, and pass along to MySQL. But it seems more complicated than that. Has anyone done something like this before? If someone could let me know how it is that I can create a body of text for each email (including the headers) so that I can then store it in the database, that would be awesome. Any advice would be much appreciated. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Write Japanese text into an existing PDF [SOLVED]
Tedd, Thank you for responding. > I used the PDFB library to create this: > http://chir.ag/projects/pdfb/ > While I've never used Japanese text, I think as long as you have a font > for it, it should work. With these scripts, I've successfully created a script that writes text on top of a PDF document. Haven't tried Japanese fonts yet, but it looks possible. Thank you for the tip. -- Dave M G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] need sample of code for Fast-CGI with php
hello, if someone have sample of code (C#, C++, delphi, etc.) to call php from an custom application (custom web server for exemple) throught fast-cgi ? thanks you by advance -- stephane Http://www.arkadia.com/fra/location-vacances/ http://www.arkadia.com/fra/immobilier/vente/france/provence-alpes-cote-d-azur/alpes-maritimes/nice/ http://www.arkadia.com/fra/location-vacances/france/provence-alpes-cote-d-azur/alpes-maritimes/nice/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying image paths with spaces
On Sun, 2009-09-06 at 23:40 -0500, Skip Evans wrote: > Hey all, > > I have a CMS system that uses the FCKeditor to allow users to > create directories in which to store images. FCK allows users > to create directories with spaces in them, and it's pretty > deep in the JavaScript code so modifying that is not a simple > option, so at this point I'm trying to work from the > assumption that the users will continue to be allowed to > create directory names with spaces. > > All that said, the CMS outputs data in two ways. I'll start > with the second method because it works and then move on to > the problem. > > What the user has created in the FCKeditor is a path to an > image that appears like this: > > src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg" > > Notice the '%20' codes for the spaces in the directory names > like 'Event images' and 'Show ads'. > > The first way the code is displayed is with an AJAX call. It's > read on the PHP side, echo'd back out to the JavaScript code > and inserted into an ID with an innerHTML assignment. This > method works. > > The first way the code is loaded is pure PHP. It's read from > the database just as it appears above and then echo'd back to > the browser. However, in the browser it appears like this: > > /clients/client_118/images//Event\ images/Show\ > ads/catspaw1compressed.jpg > > And of course the browser can't display the image with those > '\ ' combinations. > > So my task is to get it to display the image properly on the > pure PHP side the same way it does via the AJAX call. > > I should also say that the code the image path resides in > contains a text, etc, so it's a block of content, containing > both text and image paths. > > Is there a way to read and echo this on the PHP side and > preserve a properly displayable path like the AJAX call, but > that also won't interfere with the rest of the HTML and text > code contained within the block of content? > > I'm stumped on this one, so any help would be greatly, > wonderfully, blissfully even... appreciated. > > Thanks, > Skip > -- > > Skip Evans > Big Sky Penguin, LLC > 503 S Baldwin St, #1 > Madison WI 53703 > 608.250.2720 > http://bigskypenguin.com > > Those of you who believe in > telekinesis, raise my hand. > -- Kurt Vonnegut > How are you outputting those URLs? PHP won't just automatically converty '%20' to a '\ '. What is the raw URL format you're getting from FCKEditor? Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php