Re: PHP Sessions and XML [message #178344 is a reply to message #178343] |
Fri, 08 June 2012 01:33 |
Jim Higgins
Messages: 20 Registered: November 2010
Karma:
|
Junior Member |
|
|
On Thu, 07 Jun 2012 16:04:04 -0400, Jerry Stuckle
<jstucklex(at)attglobal(dot)net> wrote:
> On 6/7/2012 3:27 PM, Jim Higgins wrote:
>>
>> Could someone point me toward a very simple bare bones example of a
>> PHP script for connecting to a server external to the one running the
>> PHP script and accepting the small XML file that server will return?
>> And maybe give me a few PHP keywords I can study for parsing that XML
>> file?
>>
>> The XML file will contain a Session ID. So a few PHP keywords related
>> to initiating a PHP session using that Session ID would be really
>> helpful.
>>
>> Thank you.
>
> These are pretty broad questions, so it's almost impossible to answer
> them exactly.
>
> Some hints - for fetching the page, the simplest way is to just fetch
> the URL using the file functions. However, your server would have to be
> configured to allow this (allow_url_fopen set to ON). Also, while this
> is a simple interface, it is pretty much limited to opening a file for
> read only - no cookies, etc.
>
> A more versatile (but a bit more complicated) way is to fetch the url
> with the curl functions. Not hard once you've done it a couple of
> times, but there are a number of options.
>
> Once you have the file, if it's a well-formed XML file you can probably
> use the SimpleXML functions to process it. Again, this is somewhat
> limited, but relatively easy to use. Another way which is more
> versatile (and handles non-well-formed documents better) is the DOM
> classes.
>
> For handling the session - impossible to tell from what you're asking.
> It depends a lot on whether the session id is passed in the file or the
> URL (and you have to pass it back) or in a cookie (in which case you
> must use the cURL function). But if you're only fetching one file, you
> shouldn't have to worry about a session id - it's a single request.
>
> Any more detail would be pure conjecture, and would very probably steer
> you along the wrong path.
Thank you Jerry. It's supposedly a well formed XML file. And just
the words "DOM classes" scares me. ;-)
But in any case you've given me some things to look into and after
that if I haven't figured it out I'll at least be able to ask a more
focused question.
Thanks again.
|
|
|