Log in

View Full Version : Having problem reading xml from url by php load



Aniruddhya Hazra
08-02-2011, 06:49 AM
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/Request.ashx?command=validateuser&username=examplereseller&password=987qwer&customer=excust&customerpassword=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.

JShor
08-02-2011, 07:18 AM
I tried the code and it works just fine for me. It's probably your PHP configuration.

Aniruddhya Hazra
08-02-2011, 07:20 AM
Can you please tell me? What configuration could it be?

Aniruddhya Hazra
08-02-2011, 12:11 PM
Still I could not do it. Can any one please help?

Thanks.

JShor
08-02-2011, 04:37 PM
Is the configuration on a server that you have access to php.ini and can restart? If not, contact your hosting provider.

Aniruddhya Hazra
08-02-2011, 06:41 PM
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.

JShor
08-03-2011, 02:16 AM
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

Aniruddhya Hazra
08-04-2011, 04:33 PM
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.

JShor
08-04-2011, 07:23 PM
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.

juanjocp
03-18-2012, 09:22 PM
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.

menmwen
12-18-2014, 05:37 AM
Hi,

Can some body help me write the php and the html code for this.? let me know how much.

Thank you,

Val


Resellername: examplereseller
Customer: excust*examplereseller
Reseller password 9876qwer
Customer’s password: 1a2b3c
Customer’s CLI: 004412345678 (when the CLI is linked to the account, your customer can use local access numbers without identifying himself with a code)


“to retrieve the call history from your customer”
https://www.voipinfocenter.com/api/request.ashx?command=calloverview&username=________&password=________&customer=_______&date=__________&callid=_________&recordcount=_____&direction=_______
username = the username of the reseller
password = the password of the reseller
customer = the username of the customer
date = the date from where the history is retrieved, format: yyyy-MM-dd HH:mm:ss Set to current time when not specified and direction is set to backward. This parameter is optional.
callid = the callid to display history of: 0 when not specified. This parameter is optional.
direction = the direction to search: valid values are 'forward' or 'backward', backward when not specified. This parameter is optional.
recordcount = the maximum number of records returned: 10 when not specified and 500 is maximum. This parameter is optional.


https://www.voipinfocenter.com/api/request.ashx?command=calloverview&username=examplereseller&password=9876qwer&customer=excust&date=2014-10-25 00:00:01&recordcount=100&direction=backward
or
https://www.voipinfocenter.com/api/request.ashx?command=calloverview&username=examplereseller&password=9876qwer&customer=excust&recordcount=500


“to use for changing the password of your customer”
https://www.voipinfocenter.com/API/Request.ashx?command=changepassword&username=________&password=________&customer=_______&oldcustomerpassword=_______&newcustomerpassword=________
username = the username of the reseller
password = the password of the reseller
customer = the username of the customer
oldcustomerpassword = the old password of the customer
newcustomerpassword = the new password of the customer

https://www.voipinfocenter.com/API/Request.ashx?command=changepassword&username=examplereseller&password=9876qwer&customer=excust&oldcustomerpassword=1a2b3c&newcustomerpassword=111abc



“to create a new customer”
https://www.voipinfocenter.com/API/Request.ashx?command=Createcustomer&username=_______&password=_________&customer=_______&customerpassword=______&geocallcli=______
username = the username of the reseller
password = the password of the reseller
customer = the username of the customer
customerpassword = the password of the customer
geocallcli = a CLI used with geocalls. CLI format should be international and digits only. +4412345678 should become %2B4412345678 in you url.

https://www.voipinfocenter.com/API/Request.ashx?command=Createcustomer&username=examplereseller&password=9876qwer&customer=excust&customerpassword=1a2b3c&geocallcli=%2B4412345678



"to check if your customer username/password combination is correct"
https://www.voipinfocenter.com/API/Request.ashx?command=validateuser&username=_______&password=______&customer=______&customerpassword=_______
username = the username of the reseller
password = the password of the reseller
customer = the username of the customer
customerpassword = the password of the customer

https://www.voipinfocenter.com/API/Request.ashx?command=validateuser&username=examplereseller&password=987qwercustomer=excust&customerpassword=1a2b3c



“to change the properties of your customer’s account: block/unblock and add/remove a CLI”
https://www.voipinfocenter.com/API/Request.ashx?command=changeuserinfo&username=____&password=_____&customer=______&geocallcli_options=_____&geocallcli______&customerblocked=_______
username = the username of the reseller
password = the password of the reseller
customer = the username of the customer
geocallcli_options = Use this in combination with geocallcli to add or delete a number. options avalaible: add / delete. This parameter is optional.
geocallcli = a geocallcli. This parameter is optional . +44123123123 should become %2B44123123123 in you url.
customerblocked = Use this to block or unblock a user. options avalable: true / false. This parameter is optional.

To block a customer:
https://www.voipinfocenter.com/API/Request.ashx?command=changeuserinfo&username=examplereseller&password=987qwer&customer=excust &customerblocked=true
To unblock a customer:
https://www.voipinfocenter.com/API/Request.ashx?command=changeuserinfo&username=examplereseller&password=987qwer&customer=excust &customerblocked=false

To add a CLI:
https://www.voipinfocenter.com/API/Request.ashx?command=changeuserinfo&username=examplereseller&password=987qwer&customer=excust&geocallcli_options=add&geocallcli=%2B4412346578
To remove a CLI
https://www.voipinfocenter.com/API/Request.ashx?command=changeuserinfo&username=examplereseller&password=987qwer&customer=excust&geocallcli_options=delete&geocallcli=%2B4412346578



“to get your customer information including current balance”
https://www.voipinfocenter.com/API/Request.ashx?command=getuserinfo&username=______&password=______&customer=________
username = the username of the reseller
password = the password of the reseller
customer = the customer of which to get the information

https://www.voipinfocenter.com/API/Request.ashx?command=getuserinfo&username=examplereseller&password=9876qwer&customer=excust



"to transfer credit to the customer"
https://www.voipinfocenter.com/api/request.ashx?command=settransaction&username=_______password=________&customer=_______&amount=________
username = the username of the reseller
password = the password of the reseller
customer = the username of the customer
amount = the amount to add or deduct from an account. Use a minus in front of the amount to deduct.

Add 2.50:
https://test.voipinfocenter.com/api/request.ashx?command=settransaction&username=examplereseller&password=987qwer&customer=excust&amount=2.50
Remove 2.50:
https://test.voipinfocenter.com/api/request.ashx?command=settransaction&username=examplereseller&password=987qwer&customer=excust&amount=-2.50