php-general Digest 2 Mar 2008 14:49:51 -0000 Issue 5325
Topics (messages 270820 through 270829):
Re: reading incoming xml
270820 by: Larry Brown
270821 by: Larry Brown
270822 by: Daniel Brown
270823 by: Andrés Robinet
270824 by: Nathan Nobbe
270826 by: Larry Brown
Re: Pear
270825 by: Nathan Nobbe
Anyone jump from Studio 5.5.x -> Zend Eclipse?
270827 by: Steve Finkelstein
270828 by: Andrés Robinet
Multiple sessions open at same time, is it possible?
270829 by: Richard
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 ---
Thanks for the help Nathan. What I'm looking for though is how to
accept and read the incoming XML the way I was sending it in curl. I am
currently using that curl mechanism on the cli to connect to another
remote XML server successfully. I want to keep that side of the
equation the same. I need to find out if I can access the incoming data
on the server side. I don't need or want to use curl on the server
side. I just want to handle the incoming XML.
How does SOAP and XML-RPC get to the incoming XML? Is the incoming SOAP
and XML-RPC packages arriving in html posts? I tried looking at the
nusoap code to determine this to no avail.
Larry
On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
> hmm, it looks to me like you want to post a bunch of raw data to the
> server. im not sure exactly how to do that w/ the php curl functions...
> everything ive seen uses CURLOPT_POSTFIELDS to supply an associative array
> of data to be posted. in this case you could easily send you data across by
> choosing a name for the index, something like 'postdata', anything will do,
> then it will be accessible on the system youre posting to via
> $_POST['postdata'].
>
> also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe youre
> using it correctly, i think youre just supposed to put a string
> representing the desired http method in there, so something like 'HEAD',
> 'PUT', or in this case 'POST'. then you would supply the data as i said
> earlier, using CURLOPT_POSTFIELDS. so in all, i think something like this
> would work for you,
>
>
>
> and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might just
> go with CURLOPT_POST => true, since you arent using an obscure http method.
> im not sure exactly how to determine if the server supports this method or
> not. anyway, i found this in 'man curl_easy_setopt' (thats the manpage for
> the c function php uses for the CURLOPT_CUSTOMREQUEST option).
>
> Many people have wrongly used this option to replace the
> entire request with their own, including multiple headers and POST contents.
> While that might
> work in many cases, it will cause libcurl to send invalid
> requests and it could possibly confuse the remote server badly. Use
> CURLOPT_POST and CUR-
> LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
> replace or extend the set of headers sent by libcurl. Use
> CURLOPT_HTTP_VERSION to change
> HTTP version.
>
> -nathan
--
Larry Brown <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---
The incoming message to the server is:
POST /vendorXML.html HTTP/1.0
MIME-Version: 1.0
Content-type: text/html
Content-length: 114
Content-transfer-encoding: text
Request-number: 1
Document-type: Request
Interface-Version: Test 1.4
Connection: close
<?xml version="1.0" encoding="UTF-8"?><Data>vendorCompanyID</Data>
Larry
On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
> hmm, it looks to me like you want to post a bunch of raw data to the
> server. im not sure exactly how to do that w/ the php curl functions...
> everything ive seen uses CURLOPT_POSTFIELDS to supply an associative array
> of data to be posted. in this case you could easily send you data across by
> choosing a name for the index, something like 'postdata', anything will do,
> then it will be accessible on the system youre posting to via
> $_POST['postdata'].
>
> also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe youre
> using it correctly, i think youre just supposed to put a string
> representing the desired http method in there, so something like 'HEAD',
> 'PUT', or in this case 'POST'. then you would supply the data as i said
> earlier, using CURLOPT_POSTFIELDS. so in all, i think something like this
> would work for you,
>
>
>
> and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might just
> go with CURLOPT_POST => true, since you arent using an obscure http method.
> im not sure exactly how to determine if the server supports this method or
> not. anyway, i found this in 'man curl_easy_setopt' (thats the manpage for
> the c function php uses for the CURLOPT_CUSTOMREQUEST option).
>
> Many people have wrongly used this option to replace the
> entire request with their own, including multiple headers and POST contents.
> While that might
> work in many cases, it will cause libcurl to send invalid
> requests and it could possibly confuse the remote server badly. Use
> CURLOPT_POST and CUR-
> LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
> replace or extend the set of headers sent by libcurl. Use
> CURLOPT_HTTP_VERSION to change
> HTTP version.
>
> -nathan
--
Larry Brown <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---
On Sat, Mar 1, 2008 at 9:33 PM, Larry Brown
<[EMAIL PROTECTED]> wrote:
> Thanks for the help Nathan. What I'm looking for though is how to
> accept and read the incoming XML the way I was sending it in curl. I am
> currently using that curl mechanism on the cli to connect to another
> remote XML server successfully. I want to keep that side of the
> equation the same. I need to find out if I can access the incoming data
> on the server side. I don't need or want to use curl on the server
> side. I just want to handle the incoming XML.
Larry,
I'm sorry that I'm not certain what you mean by "remote XML
server", since XML is a markup language and a server (in this context)
insinuates an HTTP (protocol) web server, but perhaps a combination of
file_get_contents() and the information from the following manual
entry will help you.
http://www.php.net/xml
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>
--- End Message ---
--- Begin Message ---
You can get what you post either with:
$postText = trim(file_get_contents('php://input');
Or with:
$postText = $GLOBALS["HTTP_RAW_POST_DATA"];
About HTTP_RAW_POST_DATA http://us2.php.net/manual/en/reserved.variables.php
Read the notes here http://us2.php.net/variables.predefined
"It should be noted that $HTTP_RAW_POST_DATA only exists if the encoding type of
the data is -not- the default of application/x-www.form-urlencoded, and so, to
accessing raw post data from an HTTP form requires setting enctype= in your
HTML. "
So, if $RAW_POST_DATA doesn't exist, it is because you should be able to use
$_POST (unless you set PHP to always populate raw post data in php.ini). The
preferred method is, however, to read 'php://input'
Then after you get the XML body, you must use one of the XML extensions
available in PHP to parse the XML data (search for it as it's not part of this
help pack ;) ).
Regards,
Rob(inet)
Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 |
Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace |
Web: bestplace.biz | Web: seo-diy.com
> -----Original Message-----
> From: Larry Brown [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 01, 2008 9:43 PM
> To: Nathan Nobbe
> Cc: php
> Subject: Re: [PHP] reading incoming xml
>
> The incoming message to the server is:
>
> POST /vendorXML.html HTTP/1.0
> MIME-Version: 1.0
> Content-type: text/html
> Content-length: 114
> Content-transfer-encoding: text
> Request-number: 1
> Document-type: Request
> Interface-Version: Test 1.4
> Connection: close
>
> <?xml version="1.0" encoding="UTF-8"?><Data>vendorCompanyID</Data>
>
>
> Larry
>
> On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
>
> > hmm, it looks to me like you want to post a bunch of raw data to the
> > server. im not sure exactly how to do that w/ the php curl functions...
> > everything ive seen uses CURLOPT_POSTFIELDS to supply an associative
> array
> > of data to be posted. in this case you could easily send you data across
> by
> > choosing a name for the index, something like 'postdata', anything will
> do,
> > then it will be accessible on the system youre posting to via
> > $_POST['postdata'].
> >
> > also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe
> youre
> > using it correctly, i think youre just supposed to put a string
> > representing the desired http method in there, so something like 'HEAD',
> > 'PUT', or in this case 'POST'. then you would supply the data as i said
> > earlier, using CURLOPT_POSTFIELDS. so in all, i think something like
> this
> > would work for you,
> >
>
> >
> >
> > and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might
> just
> > go with CURLOPT_POST => true, since you arent using an obscure http
> method.
> > im not sure exactly how to determine if the server supports this method
> or
> > not. anyway, i found this in 'man curl_easy_setopt' (thats the manpage
> for
> > the c function php uses for the CURLOPT_CUSTOMREQUEST option).
> >
> > Many people have wrongly used this option to replace the
> > entire request with their own, including multiple headers and POST
> contents.
> > While that might
> > work in many cases, it will cause libcurl to send
> invalid
> > requests and it could possibly confuse the remote server badly. Use
> > CURLOPT_POST and CUR-
> > LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
> > replace or extend the set of headers sent by libcurl. Use
> > CURLOPT_HTTP_VERSION to change
> > HTTP version.
> >
> > -nathan
> --
> Larry Brown <[EMAIL PROTECTED]>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Sat, Mar 1, 2008 at 9:33 PM, Larry Brown <
[EMAIL PROTECTED]> wrote:
> Thanks for the help Nathan. What I'm looking for though is how to
> accept and read the incoming XML the way I was sending it in curl. I am
> currently using that curl mechanism on the cli to connect to another
> remote XML server successfully. I want to keep that side of the
> equation the same. I need to find out if I can access the incoming data
> on the server side. I don't need or want to use curl on the server
> side. I just want to handle the incoming XML.
>
> How does SOAP and XML-RPC get to the incoming XML? Is the incoming SOAP
> and XML-RPC packages arriving in html posts? I tried looking at the
> nusoap code to determine this to no avail.
im sorry to say this larry, but at this point im a little bit confused. as
dan said, xml is a markup language not a protocol, and as i said there are 2
ways to send data using an HTTP POST request and curl, per my previous
post. the only thing youd have to do is come up w/ an index for the array
you supply to the curl option CURLOPT_POSTFIELDS and viola, you will have
the data available in the $_POST array on the server you are posting to via
curl.
you can also try what Rob said as well to grab the raw POST response.
however, im not sure i would use CURLOPT_CUSTOMREQUEST in the way you are,
in fact im surprised its even generating a POST request, because i dont see
how youve specified it in your request, and GET is the default curl HTTP
request method.
im also a little lost when you say you dont want to use curl on the server
side. if you used CURLOPT_POSTFIELDS (on the 'client side') as i
recommended in my previous post all you have to do is grab the response from
the $_POST array on the 'server side', ergo no curl involved server side.
so, in summary, im not trying to be rude, im just trying to get on the same
page, lingo wise, and understand what was insufficient about my previous
suggestion.
-nathan
--- End Message ---
--- Begin Message ---
This is what I was looking for. Thank you. I could not change the
client since that client is being used for other servers in its current
configuration. All I needed was a way to get to the XML string coming
in.
$postText = trim(file_get_contents('php://input');
worked perfectly. Now that I have this blob of XML I can give it to
simpleXML or another parser I was recently shown to work with it. I'm
surprised it was so difficult to find. $GLOBALS['HTTP_RAW_POST_DATA']
was empty by the way and that I'd seen before.
Also, sorry if I threw anyone off by referring to the other server the
client works with as an XML server. I only referred to it as such
because it is a server that accepts XML input and responds with XML
output to a number of clients. It is not used as a typical html server
for browsing etc.
Anyway, I was looking to get a hold of the raw data coming in and it
looks like this was it. I really do appreciate the help...
Larry
On Sat, 2008-03-01 at 22:06 -0500, Andrés Robinet wrote:
> You can get what you post either with:
>
> $postText = trim(file_get_contents('php://input');
>
> Or with:
>
> $postText = $GLOBALS["HTTP_RAW_POST_DATA"];
>
> About HTTP_RAW_POST_DATA http://us2.php.net/manual/en/reserved.variables.php
> Read the notes here http://us2.php.net/variables.predefined
>
> "It should be noted that $HTTP_RAW_POST_DATA only exists if the encoding type
> of
> the data is -not- the default of application/x-www.form-urlencoded, and so, to
> accessing raw post data from an HTTP form requires setting enctype= in your
> HTML. "
>
> So, if $RAW_POST_DATA doesn't exist, it is because you should be able to use
> $_POST (unless you set PHP to always populate raw post data in php.ini). The
> preferred method is, however, to read 'php://input'
>
> Then after you get the XML body, you must use one of the XML extensions
> available in PHP to parse the XML data (search for it as it's not part of this
> help pack ;) ).
>
> Regards,
>
> Rob(inet)
>
> Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
> 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
> TEL 954-607-4207 | FAX 954-337-2695 |
> Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace |
> Web: bestplace.biz | Web: seo-diy.com
>
> > -----Original Message-----
> > From: Larry Brown [mailto:[EMAIL PROTECTED]
> > Sent: Saturday, March 01, 2008 9:43 PM
> > To: Nathan Nobbe
> > Cc: php
> > Subject: Re: [PHP] reading incoming xml
> >
> > The incoming message to the server is:
> >
> > POST /vendorXML.html HTTP/1.0
> > MIME-Version: 1.0
> > Content-type: text/html
> > Content-length: 114
> > Content-transfer-encoding: text
> > Request-number: 1
> > Document-type: Request
> > Interface-Version: Test 1.4
> > Connection: close
> >
> > <?xml version="1.0" encoding="UTF-8"?><Data>vendorCompanyID</Data>
> >
> >
> > Larry
> >
> > On Sat, 2008-03-01 at 18:08 -0500, Nathan Nobbe wrote:
> >
> > > hmm, it looks to me like you want to post a bunch of raw data to the
> > > server. im not sure exactly how to do that w/ the php curl functions...
> > > everything ive seen uses CURLOPT_POSTFIELDS to supply an associative
> > array
> > > of data to be posted. in this case you could easily send you data across
> > by
> > > choosing a name for the index, something like 'postdata', anything will
> > do,
> > > then it will be accessible on the system youre posting to via
> > > $_POST['postdata'].
> > >
> > > also, inlooking at your usage of CURLOPT_CUSTOMREQUEST, i dont believe
> > youre
> > > using it correctly, i think youre just supposed to put a string
> > > representing the desired http method in there, so something like 'HEAD',
> > > 'PUT', or in this case 'POST'. then you would supply the data as i said
> > > earlier, using CURLOPT_POSTFIELDS. so in all, i think something like
> > this
> > > would work for you,
> > >
> >
> > >
> > >
> > > and also, in reading the warning about CURLOPT_CUSTOMREQUEST, you might
> > just
> > > go with CURLOPT_POST => true, since you arent using an obscure http
> > method.
> > > im not sure exactly how to determine if the server supports this method
> > or
> > > not. anyway, i found this in 'man curl_easy_setopt' (thats the manpage
> > for
> > > the c function php uses for the CURLOPT_CUSTOMREQUEST option).
> > >
> > > Many people have wrongly used this option to replace the
> > > entire request with their own, including multiple headers and POST
> > contents.
> > > While that might
> > > work in many cases, it will cause libcurl to send
> > invalid
> > > requests and it could possibly confuse the remote server badly. Use
> > > CURLOPT_POST and CUR-
> > > LOPT_POSTFIELDS to set POST data. Use CURLOPT_HTTPHEADER to
> > > replace or extend the set of headers sent by libcurl. Use
> > > CURLOPT_HTTP_VERSION to change
> > > HTTP version.
> > >
> > > -nathan
> > --
> > Larry Brown <[EMAIL PROTECTED]>
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Larry Brown <[EMAIL PROTECTED]>
--- End Message ---
--- Begin Message ---
On Sat, Mar 1, 2008 at 7:57 PM, <[EMAIL PROTECTED]> wrote:
> > when you run you phpinfo script that you mentioned
> > in your first post, do you see pear in one of the sections there (not
> just
> > in the include path)?
>
> A search on "pear" only yields this line:
> include_path .:/usr/local/php4/share/pear
> .:/usr/local/php4/share/pear
>
> Here is the page, so you can check it out if you want:
>
> http://everoriginal.onlinewebshop.net/phpInfo.php
>
yikes, php4 !? if they dont host php5 that could be reason enough to
switch, *ducks*. also, it looks like they have exec() disabled, but not
shell_exec(), so you could probly use that to run the find command from
earlier if you wanted to.
> > also, as i said pear is a modular system, so even
> > if
> > pear is installed, the DB package may not be installed.
>
> Is there something I could "include" from pear that would have an
> extremely high possibility of being installed?
im not sure, but i dont think so. you may be able to use php functions to
search the directory structure beneath the include path youve already
posted, however, this is just a lame solution that wont really accomplish
much.
> yes, you will have to use putty to connect to the host and issue unix
> > commands if you want to get to the bottom of this
>
> Probably a good idea anyway, eh? I'll work on it...
ftp only access drive me nuts ;)
> ..."SSH Manager section is not available for your hosting plan!"
>
> I get free hosting at this place. I'd like to test it out before I buy,
> but maybe I'll just have to bite the bullet.
>
ouch :D
as Rick said in a later post the pear libraries are just php files. but
installing them into your webroot manually has a couple of caveats,
1. pain in the ass compared to using pear cli program
2. you expose these library files to the public unless you add a
.htaccess file to the server to protect them
but you would have the benefit of controlling the version of these libraries
you were using. also, in that case youll want to override the include_path
setting using a .htaccess file so that if there are any pear packages
installed by the hosting company, youre scripts will use the ones in the
pear installation directory you create.
-nathan
--- End Message ---
--- Begin Message ---
Hi all,
I've tried googling around to find some blogs with decent information
on whether Zend Eclipse is mature enough to make the jump over from
5.5.x just yet.
Admittedly, I've dropped Zend Studio as of late and been writing all
of my code in TextMate -- but at the end of the day when a project is
complex enough, Zend Studio is much more powerful than TextMate with
all of its features and remote debugging capabilities.
Anyhow, I'm curious if it's worth it to check out Zend Eclipse yet.
We're a team of about 5-6 developers and I've been getting asked by a
few colleagues if I've tried it out yet since I'm usually the one to
try out the newer technologies.
I'd love to hear some feedback.
Thanks!
/sf
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Steve Finkelstein [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 02, 2008 12:48 AM
> To: php-general
> Subject: [PHP] Anyone jump from Studio 5.5.x -> Zend Eclipse?
>
> Hi all,
>
> I've tried googling around to find some blogs with decent information
> on whether Zend Eclipse is mature enough to make the jump over from
> 5.5.x just yet.
>
> Admittedly, I've dropped Zend Studio as of late and been writing all
> of my code in TextMate -- but at the end of the day when a project is
> complex enough, Zend Studio is much more powerful than TextMate with
> all of its features and remote debugging capabilities.
>
> Anyhow, I'm curious if it's worth it to check out Zend Eclipse yet.
> We're a team of about 5-6 developers and I've been getting asked by a
> few colleagues if I've tried it out yet since I'm usually the one to
> try out the newer technologies.
>
> I'd love to hear some feedback.
>
> Thanks!
>
> /sf
I'm also interested on this. I've tested Zend Eclipse just a bit and it looks
promising, except for what we all know about Eclipse (and Zend) it eats all your
RAM like a critter.
I use Dreamweaver (yeah, don't laugh!) for the purely HTML related stuff
(however, almost never the design view), Topstyle for CSS and PHPDesigner for
PHP coding (if you usually use an MVC-like framework, you may know what I mean).
However, it's almost always only me involved in the process (maybe one more dev
and rarely three of us).
Eclipse sounds like a panacea because in theory you can even add code completion
for JavaScript and get the best out of JS coding when you use, say Prototype or
ExtJS. But, every time I tried Eclipse (whatever "flavor" you pick), I had a
hard time trying to get "what I want" out of it. I prefer simplicity and I'm
bound by a kind of Unix philosophy (get several programs, each one doing
"exactly what you want" and concatenate the outputs of each). But that's me and
that's me right NOW.
If I had to work with more than two people, I'd surely take the Eclipse learning
curve once and forever and I'd upgrade my hardware to tons of RAM if necessary.
In a team you need integration (that's what IDEs are good for), and I don't know
of another IDE that can provide you as many features for as many languages.
If I was in your shoes, I'd give Zend Eclipse a respectful try. Moreover, if you
are Mr-T in your office ("T" for technology), they will expect you to do so.
And... there's no textmate for Windows (is there any?) if you ever consider that
OS as a development platform, nor there is anything compared to Eclipse (at
least I didn't find something alike). And... Zend Studio is the past, Zend
Eclipse is the present and future (if you like Zend Products):
"We expect that for many customers an Eclipse based product will be preferable.
With all the functionality and extensibility of Eclipse, it simply provides
richer functionality than Zend could create on our own. However, by continuing
to support and maintain Zend Studio V5.5 we will let customers decide when to
migrate to the next generation product. Migration tools are provided to
streamline the adoption process." - http://www.zend.com/products/studio/studio55
Anyway, I don't have such an experience in team leadership for more than
two/three people (including myself in the group), so I can be wrong. I'd LOVE to
hear a "real voice", speaking about "real projects" and "real teams", where you
need a common environment to avoid development chaos. I would buy a book on the
subject if you can recommend one (but one about the "real thing" and not too
academically oriented).
Regards,
Rob
Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 |
Email: [EMAIL PROTECTED] | MSN Chat: [EMAIL PROTECTED] | SKYPE: bestplace |
Web: bestplace.biz | Web: seo-diy.com
--- End Message ---
--- Begin Message ---
Hello,
I'm quite new to sessions, an am trying to program a script which needs
two sessions ...
I have a members area which uses 1 session, and when you click on
disconnect it closes the session and the user returns to the login page.
I also am programming a shopping cart so members can choose what they
would like to download that also uses a session.
All worked fine untill I realised that because they both use the same
session, when I disconnect from the members area it also obviously
deletes all elements from the download cart.
I would there for need to have two seperate sessions one for the cart,
and one for the members area. And sometimes I will need to have them
both open.
Is this possible ? I've searched google but not found anything
interesting, except session_name, but I still don't know how to open two
sessions or close one session but not the other, or open a variable in
a specific session ...
Thanks in advance,
Richard
--- End Message ---