php-general Digest 2 Feb 2007 08:45:09 -0000 Issue 4603
Topics (messages 248165 through 248183):
Trouble...
248165 by: Leandro Martín Peralta
Combining 2 DOM XML nodes from different documents
248166 by: Eli
248181 by: Eli
OT - PHP Code Search
248167 by: WeberSites LTD
248168 by: Robert Cummings
248169 by: tg-php.gryffyndevelopment.com
248170 by: Robert Cummings
248172 by: Robert Cummings
Re: Send Email to Mobile
248171 by: Richard Lynch
Re: Who uses PHP
248173 by: Jon Anderson
PHP5 & Commercial Development
248174 by: Eric Gorr
248175 by: Ligaya A. Turmelle
248177 by: Chris
date to string
248176 by: John Taylor-Johnston
248178 by: Chris
248179 by: John Taylor-Johnston
248180 by: Chris
Re: nested, referenced foreach & implicit current array pointer issues
248182 by: Jochem Maas
accepting POST variables using CURL
248183 by: chetan rane
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:
php-general@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
I have an xml stored in a variable. If I load it in a domdocument as HTML:
$DDoc->loadHTML($xml);
I can get elements by an xpath query, but if I instead load it as XML my
xpath queries stop working:
$DDoc = new DOMDocument();
$DDoc->loadXML($xml);
$xpath = new DOMXPath($DDoc);
$query = "//[EMAIL PROTECTED]".$i."]";
$topics = $xpath->query($query);
I've checked that the xml is well formated, no error or warning is
displayed. $topics is just empty. Do anyone know why this could happen?
Thank you for your attention.
--- End Message ---
--- Begin Message ---
Hi,
<?php
$x1 = <<<EOT
<a p1="v1">
<a1 p1="vv1"/>
</a>
EOT;
$x2 = <<<EOT
<b p1="v1">
<b1 p1="vv1"/>
</b>
EOT;
$X1 = new DOMDocument();
$X1->loadXML($x1);
$X2 = new DOMDocument();
$X2->loadXML($x2);
$X1->firstChild->appendChild($X2->firstChild->cloneNode(true));
echo htmlspecialchars($X1->saveXML());
?>
I got an error in the line $X1->firstChild->appendChild...
[01-Feb-2007 22:20:29] PHP Fatal error: Uncaught exception
'DOMException' with message 'Wrong Document Error' in
E:\www\mysite\htdocs\combine.php:17
How can I combine these 2 XMLs to get:
<a p1="v1">
<a1 p1="vv1"/>
<b p1="v1">
<b1 p1="vv1"/>
</b>
</a>
-thanks! :-)
--- End Message ---
--- Begin Message ---
<?php
$x1 = <<<EOT
<a p1="v1">
<a1 p1="vv1"/>
</a>
EOT;
$x2 = <<<EOT
<b p1="v1">
<b1 p1="vv1"/>
</b>
EOT;
$X1 = new DOMDocument();
$X1->loadXML($x1);
$X2 = new DOMDocument();
$X2->loadXML($x2);
$X1->firstChild->appendChild($X2->firstChild->cloneNode(true));
echo htmlspecialchars($X1->saveXML());
?>
I got an error in the line $X1->firstChild->appendChild...
[01-Feb-2007 22:20:29] PHP Fatal error: Uncaught exception
'DOMException' with message 'Wrong Document Error' in
E:\www\mysite\htdocs\combine.php:17
Found the answer. Should use DOMDocument->importNode() method, and just
append the imported node.
-thanks!
--- End Message ---
--- Begin Message ---
If you are looking for php code examples try searching for them at
http://www.php-code-search.com/
berber
--- End Message ---
--- Begin Message ---
On Thu, 2007-02-01 at 22:51 +0200, WeberSites LTD wrote:
> www.php-cod-search.com/
Why? Is this a new site you've set up with disgusting amounts of
advertising?
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Not too many ads on the pages after you find what you're searching for, and
mostly just some "ads by google" type stuff.
Speaking of Google.. you can also go here for PHP code searching.. I do all my
"cod" (sic) searching there! Fresh!
http://www.google.com/codesearch?q=lang%3Aphp&hl=en&btnG=Search+Code
-TG
= = = Original message = = =
On Thu, 2007-02-01 at 22:51 +0200, WeberSites LTD wrote:
> www.php-cod-search.com/
[-TG edit: www.php-code-search.com/ Fixed!]
Why? Is this a new site you've set up with disgusting amounts of
advertising?
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
On Thu, 2007-02-01 at 16:18 -0500, [EMAIL PROTECTED] wrote:
> Not too many ads on the pages after you find what you're searching for, and
> mostly just some "ads by google" type stuff.
>
> Speaking of Google.. you can also go here for PHP code searching.. I do all
> my "cod" (sic) searching there! Fresh!
>
> http://www.google.com/codesearch?q=lang%3Aphp&hl=en&btnG=Search+Code
>
> -TG
>
> = = = Original message = = =
>
> On Thu, 2007-02-01 at 22:51 +0200, WeberSites LTD wrote:
> > www.php-cod-search.com/
>
> [-TG edit: www.php-cod-search.com/ Fixed!]
*smirk*
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
On Thu, 2007-02-01 at 23:51 +0200, WeberSites LTD wrote:
> I guess you have no real use for advertising cause no one really comes to
> your site.
> Go get a life instead of sending idiotic emails to the list.
*lol* That's not what you said when you tried to recruit me as a forum
moderator for the dweeber site several months ago.
BTW, I have a life, my wife and two kids are more life than a website
and a framework could ever give me.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--- End Message ---
--- Begin Message ---
Add a Reply-to: field on your headers.
http://php.net/mail
Read about the fifth argument.
On Thu, February 1, 2007 10:17 am, Marcelo Ferrufino Murillo wrote:
> Hi guys, I have a script that send emails to mobiles:
>
> <?php
> $subject=$_REQUEST["sb"];
> $nmobile=trim($_REQUEST["nmobile"]);
> $message=$_REQUEST["message"];
> $header="From: [EMAIL PROTECTED]";
>
> //Bolivia providers
> switch($nmobile[1]){
> case 0: $company="@viva-gsm.com"; break;
> case 1: $company="@entelmovil.com.bo";break;
> case 2:
> case 3: $company="@movil.com.bo"; break;
> case 6:
> case 7: $company="@tigo.com.bo";break;
> }
> $number="591".$nmobile.$company;
> if( @mail($number,$subject,$message,$header))
> echo "Message sent";
> else echo "error";
> ?>
>
> And this is the message in a mobile: [EMAIL PROTECTED]
> ................
>
>
> I don´t know why appear the address [EMAIL PROTECTED] the address
> must
> be: [EMAIL PROTECTED], could you help me please, thank you
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Eric Gorr wrote:
PHP has to many security issues and should not be used with a
user authentication system.
We should use XXX.
Well, people's complaints about PHP probably stem from some security
pitfalls built-in for simplicity's sake. (The most common being
register_globals.) For that reason, I strongly agree with the general
sentiments of many posters: code is as secure as the least capable
developer can make it.
I write code in C, python, Perl, PHP, Java, C#, JavaScript, etc, etc...
I don't find PHP to be inherently less secure than any other language.
I've recently run into a company that has a payment web service that
handles outgoing transactions. They have a hole in their system that
could be used to rip off e-commerce sites accross the internet. (Site
thinks the person has paid, where they have not.) Their code is written
in ASP. Is it ASP's fault? No. It's the programmers who failed to
recognize the hole in their protocol.
jon
--- End Message ---
--- Begin Message ---
I haven't tracked this particular issue, but I know when PHP5 was
first released is wasn't recommended in a commercial/production
environment. However, a lot of time has passed and we're at v5.2
now...have things changed? Have Google&Yahoo, for example, moved to
PHP5? Or is PHP4 still the recommendation for such environments?
--- End Message ---
--- Begin Message ---
AFAIK php5 is the preferred production/enterprise environment.
(buzzword +1)
Respectfully,
Ligaya Turmelle
-----Original Message-----
From: Eric Gorr [mailto:[EMAIL PROTECTED]
Sent: Friday, February 02, 2007 9:13 AM
To: php-general@lists.php.net
Subject: [PHP] PHP5 & Commercial Development
I haven't tracked this particular issue, but I know when PHP5 was first
released is wasn't recommended in a commercial/production environment.
However, a lot of time has passed and we're at v5.2 now...have things
changed? Have Google&Yahoo, for example, moved to PHP5? Or is PHP4 still
the recommendation for such environments?
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Eric Gorr wrote:
I haven't tracked this particular issue, but I know when PHP5 was first
released is wasn't recommended in a commercial/production environment.
However, a lot of time has passed and we're at v5.2 now...have things
changed? Have Google&Yahoo, for example, moved to PHP5? Or is PHP4 still
the recommendation for such environments?
It really depends. I'm sure I'll get some arguments about this but hey :P
If you're writing applications where you control or have a say in the
system environment (eg an internal system or you can talk to the
sysadmin about what should be running), then go for the latest.
If you're writing applications where you have no control over the
environment - that is, your target market is using shared hosting, then
you have to back down a little bit and not go for the very latest.
A lot of shared hosts still use php4 for whatever reason, so you need to
make your code work with that version instead.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
How do I take "2007-02-01" and turn it into Thursday, February 1, 2006?
Simple question, except I don't know the answer :)
This is all I see for now:
http://ca.php.net/manual/en/function.px-date2string.php
John
--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
How do I take "2007-02-01" and turn it into Thursday, February 1, 2006?
Use strtotime (http://php.net/strtotime) to turn it into a timestamp and
then format it using date (http://php.net/date).
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Chris wrote:
John Taylor-Johnston wrote:
How do I take "2007-02-01" and turn it into Thursday, February 1, 2006?
Use strtotime (http://php.net/strtotime) to turn it into a timestamp and
then format it using date (http://php.net/date).
echo date("l, F j, Y", strtotime("2007-02-01"));
That's it?
--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
Chris wrote:
John Taylor-Johnston wrote:
How do I take "2007-02-01" and turn it into Thursday, February 1, 2006?
Use strtotime (http://php.net/strtotime) to turn it into a timestamp
and then format it using date (http://php.net/date).
echo date("l, F j, Y", strtotime("2007-02-01"));
That's it?
Seems to work ;)
$ php -a
<?php
Interactive mode enabled
echo date("l, F j, Y", strtotime("2007-02-01"));
Thursday, February 1, 2007
Just noticed your original message said about turning 2007-02-01 into
2006 :P heh.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Roman Neuhauser wrote:
...
>
> Singleton in Design Patterns, p. 127:
>
> : Intent
> : Ensure a class only has one instance, and provide a global point of
> : access to it.
>
> The second part is IMO pretty much what you said.
it's completely out of context:
a, there is no suggestion of a class (by me)
b, there is no suggestion that the data returned by the proposed function may
only exist as a single instance.
>
>>> If you're affraid that someone will break a convention which says that
>>> the global associative array $foos has string indexes and values must be
>> given an array of data that is used all over a php application then it quite
>> simply
>> saves alot fo headaches down the road to to agree on a convention that says
>> 'we' will use a function to retrieve this data whenever it is needed
>> (regardless
>
> Agreeing on abandoning global variables would save even more headaches.
so what's your solution to data that is shared accross an application? - for
instance
user data - or should every bit of code [re]retrieve the user data from the
database?
and is the database really not just a 'global variable' wrapped up in a couple
of
functions that are used to return data? and where would the 'key' come from that
allows for the retrieval of said user data?
>
>>> positive integers, or that it needs to be an array at all
>>> ($GLOBALS['foos'] = new sabotage("haha")), you would be better off in
>>> e. g. C++ with
>>>
>>> std::map<std::string, uint32_t> foos;
>> please refrain from the old
>> 'you-should-be-using-language-FOO-look-i'll-show-you-how-clever-I-am'
>> argument it's not really adding anything to this discussion.
>
> Originally I wanted to illustrate my point using PHP, but it's much more
> code. Sorry if I hurt your feelings.
hardly - it's just that this is a php list - C++ examples aren't very useful
on the whole, and the language comparison is never truely orthogonal.
>
>>> It's not control over data types, it's visibility of access that causes
>>> most of the lossage. Wrapping the global in a function doesn't remove
>>> the structural defect.
>> huh?
>
> If PHP was statically typed, global variables would still be a bad
> smell. They are bad smell in C++ and Java, for example. It's too easy
> to call getfoo() before you have set up $foo. The risk grows
> exponentially: as soon as you add another global, $bar, you risk that
> you or someone else will use getfoo() inside initbar(), and getbar()
> inside initfoo() (or getfoo() inside initfoo()). Of course, it will be
> several function calls deep, and quite probably only happen in a code
> path that's rarly used (such as error handling).
that is just utterly contrived? why does there need to be 2 seperate functions
for init() & get()? doesn't encapsulation suggest that hiding the init()
specifics
within the get()is a good idea - why should the caller of get() have to worry
about the init() at all?
[sounds like unit testing is forcing a very rigid view of how to do things -
given that unit testing 'forces' lego-brick type of code it might be worth
considering that lots of real-world building are built from concrete. - granted
it's a weird analogy]
where does $foo come from and how it is initialized in your world exactly?
and how do you suggest using, accessing, retrieving $foo?
(i'm assuming you have a perfume to battle against all these awfully bad smells)
>
--- End Message ---
--- Begin Message ---
HI al
i tried curl to access HTTPS pages but how do i get the POST variables been
passed to me .
here is teh exact thing which i want.
i have a HTML page when i submit the form i want ot read all teh POST data
using HTTPS.
I know its possible using CURL but dont exactly know how to do it
--
Have A plesant Day
Chetan. D. Rane
Location: Pune , India
Contact: +91-9890792762
otherID: [EMAIL PROTECTED]
[EMAIL PROTECTED]
--- End Message ---