vendredi 16 août 2019

Laravel Curl Library {message:authorization required}

Could someone please let me know what i am doing wrong here? It says {"message": "Authorization required."}

public function disp_msg(Request $request)
    {
        $response=Curl::to('http://192.XXX.X.XX/api/v1/system/display_message')
        ->withHeader('Content-Type: application/x-www-form-urlencoded')
        ->withHeader('Accept: application/json')
        ->withHeader('Content-Type: application/json')
        ->withOption("USERPWD","b837725db7c294f8fdcc6e54d50d5bc1:e45b77ca1ac6bca3529a4ec3d9abbc3de65591e26c9baea3f6010e0b38ec90c9")
        ->withData(["message"=>"abc"])
        ->post();
        print_r($response);
    }

It should display the message abc on the 3D printer Ultimaker S5. Rather it says {message:Authorization Required} Any help or thoughts on it. I am sure its a syntax or version error, please someone can help on it? Thanks!




Aucun commentaire:

Enregistrer un commentaire