Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Having problem reading xml from url by php load

  1. #1
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation Having problem reading xml from url by php load

    Hello,

    I am having a problem reading xml file from url. Please watch my simple code bellow


    $dom=new DOMDocument();
    $dom->load("https://www.voipinfocenter.com/API/Request.ashx?command=validateuser&username=examplereseller&password=987qwer&customer=excust&customerpassword=1a2b3c");


    But the its not being loading rather giving warning as follows -

    Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "https://www.voipinfocenter.com/API/Request.ashx?command=validateuser&username=examplereseller&password=987qwer&customer=excust&customerpassword=1a2b3c"

    But you can see from browser with the url https://www.voipinfocenter.com/API/R...assword=1a2b3c

    It's giving output as bellow
    <ValidateUser>
    <Customer>excust*examplereseller</Customer>
    <Result>Failed</Result>
    <Reason>Reseller/Password combination unknown</Reason>
    </ValidateUser>

    Can anyone please help me?

    Thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    I tried the code and it works just fine for me. It's probably your PHP configuration.

  3. #3
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Can you please tell me? What configuration could it be?

  4. #4
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Still I could not do it. Can any one please help?

    Thanks.

  5. #5
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Is the configuration on a server that you have access to php.ini and can restart? If not, contact your hosting provider.

  6. #6
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I am using this script in my local server(localhost) with same link and there are a php.ini file. So can you please tell me how to configure the php.ini file? Thanks.

  7. #7
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    You can change php.ini to accept external URL's by changing the key, allow_url_fopen to On.

    However, this poses a huge security risk to your machine. I would recommend using cURL.
    http://php.net/manual/en/book.curl.php

  8. The Following User Says Thank You to JShor For This Useful Post:

    Aniruddhya Hazra (08-04-2011)

  9. #8
    Join Date
    Aug 2011
    Posts
    13
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thank you. I uploaded the code to another remote server and found it to work properly.

    It worked there. For now my problem is solved. But in my local machine its not working though allow_url_fopen is set to On already.

    Any ways its not that required now to my local machine.

    Thank you very much.

  10. #9
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    You're welcome. Since it's your local machine, it could also be that your firewall is blocking external loads. That might be helpful in the future.
    - Josh

  11. #10
    Join Date
    Mar 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Dear Aniruddhya Hazra

    I need to get in touch with you as I am making this application. I need your help to put the API in my website.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •