Git Product home page Git Product logo

Comments (11)

EvilFreelancer avatar EvilFreelancer commented on May 29, 2024 1

@kroot007 hello! You may use try catch for this, list of all available exceptions is here: https://github.com/EvilFreelancer/routeros-api-php/tree/master/src/Exceptions

And here is working example of your case: https://github.com/EvilFreelancer/routeros-api-php/blob/master/examples/exception.php#L10-L21

 ~/Documents/Repository/evilfreelancer/routeros-api-php/examples $ php exception.php 
Unable to establish socket session, Connection refused

from routeros-api-php.

EvilFreelancer avatar EvilFreelancer commented on May 29, 2024

Hello! It seems like your Mikrotik device is unavailable for api client. You checked ability to connect via for example telnet of ssh?

from routeros-api-php.

nkuldip avatar nkuldip commented on May 29, 2024

On test server it's working fine http://137.74.253.59/b2b_mikrotik/test.php

Same code set on production it's not working https://srpvolvoparts.com/b2b_mikrotik/test.php

from routeros-api-php.

EvilFreelancer avatar EvilFreelancer commented on May 29, 2024

And you checked availability of RouterOS from production server via command line?

from routeros-api-php.

nkuldip avatar nkuldip commented on May 29, 2024

how can i check it ?

from routeros-api-php.

EvilFreelancer avatar EvilFreelancer commented on May 29, 2024

It should be easy, you just need login to production server and check access to API port of your RouterOS, it should be 8728 or 8729 (in ssl mode) if you not changed it via config.

nmap might be useful for you:

~$ nmap -p 8728 192.168.1.1
Starting Nmap 7.80 ( https://nmap.org ) at 2019-10-21 13:26 MSK
Nmap scan report for router.lan (192.168.1.1)
Host is up (0.00039s latency).

PORT     STATE SERVICE
8728/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

If you don't have nmap on server then just try to start from ping and ssh, but for the fist you need login to your production server via ssh.

If you are a Windows user, then most likely you will be more comfortable using the PuTTY program instead CLI ssh client.

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

from routeros-api-php.

EvilFreelancer avatar EvilFreelancer commented on May 29, 2024

@nkuldip hi! Did it work for you?

from routeros-api-php.

nkuldip avatar nkuldip commented on May 29, 2024

@nkuldip hi! Did it work for you?

yes working

from routeros-api-php.

kroot007 avatar kroot007 commented on May 29, 2024

i have the same error but i want to know if can't connect return "can't connect" how can i do this

from routeros-api-php.

lgabrielc avatar lgabrielc commented on May 29, 2024

Hi! Hello, I also have the same error and when using NMAP I get this as a result:
nmap -p 8728 192.168.1.1
Starting Nmap 7.92 ( https://nmap.org ) at 2022-08-19 00:29 UTC
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.16 seconds.
Could you help me please ?

from routeros-api-php.

toxicking-techguru avatar toxicking-techguru commented on May 29, 2024

I am getting this error on cpanel but works on localhost @EvilFreelancer help i am almost satisfied that the problem is not on mikrotik router.

RouterOS\Exceptions\ConnectException
Unable to establish socket session, Connection refused

from routeros-api-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.