php-general Digest 23 Dec 2007 01:08:28 -0000 Issue 5195
Topics (messages 266223 through 266229):
Re: XML Parse Error
266223 by: Zoltán Németh
Re: Just to confirm...
266224 by: Richard Heyes
application/x-pkcs7-mime decoding class?
266225 by: Zoltán Németh
PHP5 Speed Issues
266226 by: Sascha Braun
email authentication
266227 by: Afan Pasalic
266228 by: Stut
Re: about __get,__set Overloading, read-only properties
266229 by: Jochem Maas
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
2007. 12. 21, péntek keltezéssel 10.12-kor VamVan ezt írta:
> Hi All,
>
> Happy Christmas!!!
>
> Please see the code below:
>
>
> $xml = "";
> $xml = '<?xml version="1.0" encoding="UTF-8"?>';
> $xml .= '<request>';
> $xml .= '<emailAddress>'.
> $this->xmlValueEncoding($post['Email']) .'</emailAddress>';
> $xml .= '<firstName>' .
> $this->xmlValueEncoding($post['FirstName']) . '</firstName>';
> $xml .= '<lastName>' .
> $this->xmlValueEncoding($post['LastName']) . '</lastName>';
> if (isset($post['Company']) && ($post['Company'] != ""))
> $xml .= '<company>' .
> $this->xmlValueEncoding($post['Company']) .'</company>';
> if (isset($post['Title']) && ($post['Title'] != ""))
> $xml .= '<jobDesc>' .
> $this->xmlValueEncoding($post['Title']) .'</jobDesc>';
> $xml .= '<password>' .
> $this->xmlValueEncoding($post['Password']) . '</password>';
> if (isset($post['Address1']) && ($post['Address1'] != ""))
> $xml .= '<address1>' .
> $this->xmlValueEncoding($post['Address1']) .'</address1>';
> if (isset($post['City']) && ($post['City'] != ""))
> $xml .= '<City>' . $this->xmlValueEncoding($post['City'])
> .'</City>';
> if (isset($post['State']) && ($post['State'] != ""))
> $xml .= '<State>' . $this->xmlValueEncoding($post['State'])
> .'</State>';
> if (isset($post['ZipCode']) && ($post['ZipCode'] != ""))
> $xml .= '<Zip>' . $this->xmlValueEncoding($post['ZipCode'])
> .'</Zip>';
> if (isset($post['Country']) && ($post['Country'] != ""))
> $xml .= '<ISOCountryCode>' .
> $this->xmlValueEncoding($post['Country']) . '</ISOCountryCode>';
> if (isset($post['Phone']) && ($post['Phone'] != ""))
> $xml .= '<Phone>' . $this->xmlValueEncoding($post['Phone'])
> . '</Phone>';
> $xml .= '</request>';
>
> function xmlValueEncoding($str) {
>
> return htmlspecialchars(trim($str), ENT_QUOTES, "UTF-8");
>
> }
>
> I receive a XML parser errow when encoding the NON US Value like accent `
> etc.
>
> Can you please suggest me a solution?
>
> I am using SOAP to send these values to a webservice.
I had the same problem with soap once, using htmlentities() on all the
strings solved the issue
greets
Zoltán Németh
>
> Thanks,
> Vamsee Vanaparthy
--- End Message ---
--- Begin Message ---
I wish I could block IE users. They almost are more trouble than they
are worth. Luckily only about 20% of my users still use IE6. :p
Technically you can, not that I can understand why you would want to
block what is the most popular browser out there. My personal sites
stats show that IE makes up roughly 37-40% of users, and being a
technically orientated site they probably aren't representative of the
Interweb at large, for that you might be better looking at
thecounter.com (http://www.thecounter.com/stats/). That shows 80%, which
is probably closer to actual usage.
--
Richard Heyes
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
that can cut the cost of online support
** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **
--- End Message ---
--- Begin Message ---
hi list,
merry christmas to you all!
and the question: does anyone know about any php classes to decode
emails which are s/mime encrypted? they contain no body and other mime
parts, only a file smime.p7m, with mime type application/x-pkcs7-mime,
disposition inline. I can download the file from imap with no problem,
but I have no idea how to decode it...
of course I found some rfc-like stuff about pkcs7 on the net, but I hope
I won't have to write the decoder based on that ;)
greets
Zoltán Németh
--- End Message ---
--- Begin Message ---
Hi Fellows,
I figured out, that PHP5 runs faster when I am not inherit classes,
I hope I use the right word.
I mean the class sub_class extends main_class notation.
As well I figured out, that I in most cases should references in
foreach loops. like
foreach($array as $key => &$value) {
}
Lots of memory is saved by that.
Now I would like to know, what other speed improvements might be
possible. What about autoload of classes, will it improve speed
when I throw the code out?
Are there other things I should take care of.
I would like to know as much as possible. Please go deep into your-
self and tell me every little thing on how you improved your applica-
tions for speed and memory optimisation, to make this thread the best
compendium on performance and memory optimisation.
Thank you very much, fellows and a merry merry christmas!
Sascha
--- End Message ---
--- Begin Message ---
Hi,
I have to develop a little registration form.
after the form is submitted confirmation email has to be sent to registrant.
I use this function to send an email:
function send_plain_email($to, $subject, $body)
{
$headers = "MIME-Versin: 1.0\n" . "Content-type: text/plain;
charset=ISO-8859-1; format=flowed\n" . "Content-Transfer-Encoding: 8bit\n" .
"Reply-To: Registration <[EMAIL PROTECTED]>\n".
"From: Registration <[EMAIL PROTECTED]>\n" .
"X-Mailer: PHP" . phpversion();
mail($to, $subject, $body, $headers) or die(mysql_errno());
}
Though, I'm getting the following error:
Warning: mail() [function.mail]: SMTP server response: 503 This mail
server requires authentication when attempting to send to a non-local
e-mail address. Please check your mail client settings or contact your
administrator to verify that the domain or address is defined for this
server. in
D:\Sites\CWIPanel\Accounts\mydomain.com\wwwroot\reservation.php on line 34
Never get such a error using LAMP.
Thanks for any help,
-afan
--- End Message ---
--- Begin Message ---
Afan Pasalic wrote:
I have to develop a little registration form.
after the form is submitted confirmation email has to be sent to
registrant.
I use this function to send an email:
function send_plain_email($to, $subject, $body)
{
$headers = "MIME-Versin: 1.0\n" . "Content-type: text/plain;
charset=ISO-8859-1; format=flowed\n" . "Content-Transfer-Encoding:
8bit\n" .
"Reply-To: Registration <[EMAIL PROTECTED]>\n".
"From: Registration <[EMAIL PROTECTED]>\n" .
"X-Mailer: PHP" . phpversion();
mail($to, $subject, $body, $headers) or die(mysql_errno());
}
Though, I'm getting the following error:
Warning: mail() [function.mail]: SMTP server response: 503 This mail
server requires authentication when attempting to send to a non-local
e-mail address. Please check your mail client settings or contact your
administrator to verify that the domain or address is defined for this
server. in
D:\Sites\CWIPanel\Accounts\mydomain.com\wwwroot\reservation.php on line 34
Never get such a error using LAMP.
I'm assuming from that comment that you're running this under Windows of
some variety? This is not a PHP problem. The mail server PHP is
configured to use (see php.ini) requires authentication. The built-in
mail function doesn't support that so you'll need to use something like
PHPMailer (Google for it).
-Stut
--
http://stut.net/
--- End Message ---
--- Begin Message ---
ked schreef:
> My idea is just your answer...happy..ing ^_^
>
> You are so warmhearted. Thanks a lot! : )
I don't get accused of that very often. are you being
sarcastic or did my suggestion help? (sorry I didn't quite
understand your reply)
>
> I will never post a question to a existing thread .
good. that's one down 1,000,983 to go :-)
>
>> -----Original Message-----
>> From: Jochem Maas [mailto:[EMAIL PROTECTED]
>> Sent: Friday, December 21, 2007 9:11 AM
>> To: ked
>> Cc: [EMAIL PROTECTED]
>> Subject: Re: [PHP] about __get,__set Overloading, read-only properties
>>
>> pleae don't reply to an existing thread when posting a new question.
>>
>> ked schreef:
>>> Hi. all ,
>>>
>>> I got a article from php 5.0 manual's comments. It's useful, offer
>>> readonly properties for classes.
>>>
>>> (look at the end of this message for the article )
>>>
>>> find out function __construct(), I want to modify
>> $this->id in it ,
>>> then I got a "readonly" Exception (defined in "__set" function).
>>>
>>> Distinctly, a read-only property could not be change via
>>> "$obj->attribute = '' " , but is could be change via
>> $this->id='',
>>> inside of class , isn't it ?
>>>
>>> How to modify __set function ?
>> don't - let __set() be the policeman it's supposed to be.
>> either create a private function to initialize values or set
>> the values directly in the array
>>
>> private function init($k, $v)
>> {
>> if (isset($this->p_arrPublicProperties[$k]))
>> $this->p_arrPublicProperties[$k]['value'] = $v; }
>>
>>> thanks for any advises.
>>>
>>> regards!
>>> ked
>>>
>>>
>>> the article is here:
>>>
>> ----------------------------------------------------------------------
>>> ------
>>> ------------------------
>>> Eric Lafkoff (22-Feb-2006 02:56)
>>>
>>> If you're wondering how to create read-only properties for
>> your class,
>>> the
>>> __get() and __set() functions are what you're looking for. You just
>>> have to create the framework and code to implement this
>> functionality.
>>> Here's a quick example I've written. This code doesn't take
>> advantage
>>> of the "type" attribute in the properties array, but is
>> there for ideas.
>>> <?php
>>> class Test
>>> {
>>> private $p_arrPublicProperties = array(
>>> "id" => array("value" => 4,"type" => "int","readonly" => true),
>>> "datetime" => array("value" => "Tue 02/21/2006
>> 20:49:23","type" =>
>>> "string", "readonly" => true),
>>> "data" => array("value" => "foo", "type" => "string",
>> "readonly" =>
>>> false)
>>> );
>>>
>>> //ked add!!!!!!!
>>> public function __construct()
>>> {
>>> $this->id = 100; //----------------------------will get
>> exception !!
>>> }
>>>
>>> private function __get($strProperty) { //Get a property:
>>> if (isset($this->p_arrPublicProperties[$strProperty])) { return
>>> $this->p_arrPublicProperties[$strProperty]["value"];
>>> } else {
>>> throw new Exception("Property not defined"); return false; } }
>>>
>>> private function __set($strProperty, $varValue) { //Set a
>> property to
>>> a value:
>>> if (isset($this->p_arrPublicProperties[$strProperty])) { //Check if
>>> property is read-only:
>>> if ($this->p_arrPublicProperties[$strProperty]["readonly"]) { throw
>>> new Exception("Property is read-only");
>>> ///////////////////////////////////---------------note here return
>>> false; } else {
>> $this->p_arrPublicProperties[$strProperty]["value"] =
>>> $varValue; return true; } } else { throw new
>> Exception("Property not
>>> defined"); return false; } }
>>>
>>> private function __isset($strProperty) {
>>> //Determine if property is set:
>>> return isset($this->p_arrPublicProperties[$strProperty]);
>>> }
>>>
>>> private function __unset($strProperty) {
>>> //Unset (remove) a property:
>>> unset($this->p_arrPublicProperties[$strProperty]);
>>> }
>>>
>>> }
>>> $objTest = new Test();
>>> print $objTest->data . "\n";
>>> $objTest->data = "bar"; //Works.
>>> print $objTest->data;
>>> $objTest->id = 5; //Error: Property is read-only.
>>> ?>
>>>
>> --
>> PHP General Mailing List (http://www.php.net/) To
>> unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
--- End Message ---