Comments (11)
@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.
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.
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.
And you checked availability of RouterOS from production server via command line?
from routeros-api-php.
how can i check it ?
from routeros-api-php.
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.
@nkuldip hi! Did it work for you?
from routeros-api-php.
@nkuldip hi! Did it work for you?
yes working
from routeros-api-php.
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.
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.
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)
- Got stuck when device is not available
- How to handle response error properly?
- Is there any way to get a user total download upload size of data?
- Wol HOT 2
- /export does not work ROUTEROS7 HOT 3
- done HOT 1
- Stream timed out error HOT 4
- Why not connecting in live server? HOT 2
- windows Socket timeout reached HOT 3
- script stucks when devbice is unavaiable HOT 2
- requires ext-sockets HOT 1
- Multiple query HOT 4
- Upgrade phpseclib HOT 7
- Why is it that when I try to use local it's fine, whereas when I try to upload it on the cpanel liveserver it can't connect HOT 2
- Can I fill the `host` not with IPv4 but with domain ? like tunnel.web.id ? HOT 2
- remove pppoe active not work HOT 1
- PHP Version Support HOT 2
- Problem executing a query HOT 1
- works with angular or nextjs frontend? HOT 1
- RestAPI HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routeros-api-php.