Skip to content
This repository was archived by the owner on Sep 2, 2018. It is now read-only.
This repository was archived by the owner on Sep 2, 2018. It is now read-only.

Error code 405 when using /server/directory/. code. #89

@ReduxRedstone

Description

@ReduxRedstone

When using php to access the root directory using /server/directory/. (which is stated on http://scales.pufferpanel.com/docs/serverdirectorydirectory to list the base files) it throws the following error:

Response HTTP Status Code : 405 Response HTTP Body : {"code":"MethodNotAllowedError","message":"GET is not allowed"}

I am able to access other directories such as /server/directory/logs which outputs:

Response HTTP Status Code : 200 Response HTTP Body : [SUPER LONG ARRAY OF FILES]

The code I'm using is as follows:

<?php

$XAccessServer = "KEY";
$XAccessToken = "KEY";

$cURL = curl_init();

curl_setopt($cURL, CURLOPT_URL, 'https://URL:5656/server/directory/.');
curl_setopt($cURL, CURLOPT_CAINFO, getcwd()."\certs\https.pem"); /*Trusting a local copy of the self-signed cert*/
curl_setopt($cURL, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($cURL, CURLOPT_HTTPHEADER, [
        "X-Access-Server: $XAccessServer",
        "X-Access-Token: $XAccessToken",
    ]
);
$data = curl_exec($cURL);

if(!$data) {
    die('Error: "' . curl_error($cURL) . '" - Code: ' . curl_errno($cURL));
} else {
    $data = json_decode($data);
    echo "<pre>".print_r($data, true)."</pre>";
}

curl_close($cURL);

so if the error is in my code please correct me. The error only happens when using /directory/. even though this is documented to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions