0

i am making some functions in PHP to connect, disconnect and execute commands. The last function what I need to make is a getStatusCode function. Does anyone know if that one exists? (It is not a status code from an Url but from the server itself)

  • Does this answer your question? https://stackoverflow.com/questions/3408049/getting-header-response-code#answer-3408114 – Marcel Feb 24 '22 at 13:48
  • no, sadly not. This is getting a status code from an Url and not from a ssh server – GetStatus_SSH Feb 25 '22 at 10:10
  • So you 're not talking about HTTP status codes. Can you clarify what status codes you 're talking about? Did you mean exit status codes from a server? Perhaps a small example? – Marcel Feb 25 '22 at 10:13
  • No I am not talking about a HTTP status code. I want to get a status code from the SSH server itself (if something doesnt go right you can see the status code from the server). but if it doesnt exist please let me know. I cant find it in the documentation – GetStatus_SSH Feb 25 '22 at 10:29
  • This is guessing depending on what you 're using. When you use `ssh2_connect()` and executing a command via `exec()` there is no native function to get the retrieved status. You can try `stream_get_contents()` to retrieve some more information. – Marcel Feb 25 '22 at 11:03

0 Answers0