To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Upgrading PHP

Upgrading PHP Issues concerning PHP version upgrades and future releases

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-07-2004, 12:47 PM   #1
ezekiel
Member
 
Join Date: Nov 2001
Posts: 34
SimpleXML with external files?

I need some help!

I have an application I'm writing that needs to retrieve an XML response from a server. I tried to use simplexml_load_file, but it doesn't seem to like loading the external file. Here is a code sample for a page that my form posts to:
PHP Code:
$user = $_POST['UserId'];
$pass= $_POST['Password'];
$sess = $_POST['SessId'];
$rv = $_POST['RS'];
$rs = $_POST['RV'];

$xmlUrl = "https://somesite.com/app?UserId=$user&Password=$pass&SessId=$sess&RS=$rs&RV=$rv";

$results = simplexml_file_load($xmlUrl);
echo
$results;
Here is the error I get:
Warning: warning: filed to load external entity "https://somesite.com/app?UserId=me&P...e&RS=100&RV=50" in C:\\path\to\myfile.php on line 11

Can you load external files with simplexml? Is there a better way to retrieve an xml response? Is it possibly because of the https?

I'd appreciate any help? Thanks!

Eddy
ezekiel is offline   Reply With Quote
Old 06-07-2004, 01:58 PM   #2
laserlight
PHP Witch
 
laserlight's Avatar
 
Join Date: Apr 2003
Location: Singapore
Posts: 12,388
From the looks of it, simplexml_load_file() doesnt allow for files off the local filesystem.

You might still be able to use conventional methods (fopen(), fsockopen() etc) to obtain the string and then use simplexml_load_string() instead.
__________________
Use Bazaar for your version control system
Read the PHP Spellbook
Learn How To Ask Questions The Smart Way
laserlight is offline   Reply With Quote
Old 06-07-2004, 02:25 PM   #3
ezekiel
Member
 
Join Date: Nov 2001
Posts: 34
Laser,

Thanks for the followup. I tried using the socket code from php.net as an example; plugging in my url and socket, but that didnt' work. Seems I can't do an HTTPS connection that way; php gives me an error that I might not have that transport enabled. After reading on php.net on the socket functions it appears i only have tcp and udp enabled and I couldn't find any documentation on how to add transports.

BTW FireFox rocks
ezekiel is offline   Reply With Quote
Old 07-16-2004, 10:22 PM   #4
fetish
Junior Member
 
Join Date: Oct 2003
Location: Seattle WA
Posts: 10
use simplexml_load_file() - your code example has the last two words transponsed (simplexml_file_load).

- MRB
fetish is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 12:39 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.