By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,142 Members | 1,946 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,142 IT Pros & Developers. It's quick & easy.

failed to open stream problem

P: 26
Hi all,

I was wondering why I always get "failed to open stream: HTTP request failed!" error in either loading a normal or xml file. i don't understand why i can't get the whole result. the result i get is only some part of the respective url (the one i tried to load). The following is my php code to open the file:

[PHP]$file= fopen('http://localhost/V3JRoute?slot=1&startX=103.880764&startY=1.335458& endX=103.886297&endY=1.334953&routeType=1&format=2 ',"r");[/PHP]

This is the result i get from the code above (the underlined text is part of the result):
PHP Warning: fopen(http://localhost/V3JRoute?slot=1&startX=103.880764&startY=1.335458& endX=103.886297&endY=1.334953&routeType=1&format=2 ) [function.fopen]: failed to open stream: HTTP request failed! $5$14:04:41,14:04:41,14:04:41,14:04:41,14:04:41$0. 0,0.0,0.0,0.0,0.0$Depart on,Turn sharp left onto,Continue on,Turn right onto in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 12

While the following is my php code to load the xml page:
[PHP]$clients = simplexml_load_file('http://localhost/mapguide/phpviewersample/cobacoba.xml');

echo $clients->routeType; [/PHP]

The following is the result i get from the code above (the underlined text is part of the result):

PHP Warning: simplexml_load_file(http://localhost/V3JRoute?slot=1&startX=103.880764&startY=1.335458& endX=103.886297&endY=1.334953&routeType=1&format=1 ) [function.simplexml-load-file]: failed to open stream: HTTP request failed! <?xml version="1.0" ?> in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Warning: http://localhost/V3JRoute?slot=1&startX=103.880764&startY=1.335458& endX=103.886297&endY=1.334953&routeType=1&format=1 :1: parser error : Document is empty in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Warning: in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Warning: ^ in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Warning: http://localhost/V3JRoute?slot=1&startX=103.880764&startY=1.335458& endX=103.886297&endY=1.334953&routeType=1&format=1 :1: parser error : Start tag expected, '<' not found in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Warning: in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Warning: ^ in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 2 PHP Notice: Trying to get property of non-object in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\xmlaccesstrial.php on line 3
I hope somebody can help me out from this issue.
Anyway, Merry Christmas....

Thank you

Regards,
Kencana
Dec 26 '06 #1
Share this Question
Share on Google+
1 Reply


P: 26
Hi all,

sorry there is small mistake in accessing xml file code...
the following is my final code:

[PHP]$clients = simplexml_load_file('http://localhost/V3JRoute?slot=1&startX=103.880764&startY=1.335458& endX=103.886297&endY=1.334953&routeType=1&format=1 ');

echo $clients->routeType;[/PHP]

Thanks...

Regards,
Kencana
Dec 26 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.