New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


php call to page request

Votes:

0

Your Vote:

Up

Down

I have this script:

$server = "https://server.com";
$fileType = "/api/table.json?";
$uName = "bart";
$pWord = "XXXXXX";
$url = "content=devices&id=2672&output=xml&columns=group,name&username=" . $uName . "&userhash=" . $pWord;

$request = $server . $fileType . $url;
echo file_get_contents($request);

when i call it via php -f file.php I get this error:

failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized

if i load the url into browser, it works as expected. any thoughts?

api php prtg

Created on Jul 1, 2014 5:05:03 PM by  bart2puck (0) 1

Last change on Jul 1, 2014 5:41:59 PM by  Konstantin Wolff [Paessler Support]



2 Replies

Votes:

0

Your Vote:

Up

Down

Hi,
in your variable $url please try using either the parameter passhash or password but not userhash. Corrected version below:

$url = "content=devices&id=2672&output=xml&columns=group,name&username=" . $uName . "&passhash=" . $pWord;

(use password as parameter if you are using the password to authenticate)
Does that work?

Created on Jul 1, 2014 5:44:42 PM by  Konstantin Wolff [Paessler Support]



Votes:

0

Your Vote:

Up

Down

passhash worked. thank you.

Created on Jul 1, 2014 5:51:14 PM by  bart2puck (0) 1



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.