FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Sessions and XML
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Sessions and XML [message #178343 is a reply to message #178342] Thu, 07 June 2012 20:04 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
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.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: sessions causing refreshing not to work
Next Topic: Query about WWW-Authenticate: Basic and bad UserID/Password recovery
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 12 20:35:50 GMT 2024

Total time taken to generate the page: 0.05049 seconds