failed to open stream problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kencana
    New Member
    • Nov 2006
    • 26

    failed to open stream problem

    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.880 764&startY=1.33 5458&endX=103.8 86297&endY=1.33 4953&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.880 764&startY=1.33 5458&endX=103.8 86297&endY=1.33 4953&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\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.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.880 764&startY=1.33 5458&endX=103.8 86297&endY=1.33 4953&routeType= 1&format=1) [function.simple xml-load-file]: failed to open stream: HTTP request failed! <?xml version="1.0" ?> in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Warning: http://localhost/V3JRoute?slot=1 &startX=103.880 764&startY=1.33 5458&endX=103.8 86297&endY=1.33 4953&routeType= 1&format=1:1: parser error : Document is empty in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Warning: in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Warning: ^ in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Warning: http://localhost/V3JRoute?slot=1 &startX=103.880 764&startY=1.33 5458&endX=103.8 86297&endY=1.33 4953&routeType= 1&format=1:1: parser error : Start tag expected, '<' not found in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Warning: in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Warning: ^ in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 2 PHP Notice: Trying to get property of non-object in C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\xmlaccesst rial.php on line 3
    I hope somebody can help me out from this issue.
    Anyway, Merry Christmas....

    Thank you

    Regards,
    Kencana
  • kencana
    New Member
    • Nov 2006
    • 26

    #2
    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.880 764&startY=1.33 5458&endX=103.8 86297&endY=1.33 4953&routeType= 1&format=1');

    echo $clients->routeType;[/PHP]

    Thanks...

    Regards,
    Kencana

    Comment

    Working...