Community discussions

 
pafflootiy
just joined
Topic Author
Posts: 10
Joined: Tue Sep 23, 2014 10:27 am

Help me with fetch

Tue Jun 05, 2018 2:07 pm

My ISP activate / deactivate services when you push the button on their webpage. I wanna do it by using "fetch" on my mikrotik.
I get data of request from my browser
Summary
URL: https://provider.ltd/path-to-script.php
Status: 200 OK
Source: Network
Address: 1.1.1.1:443

Request
POST /path-to-script.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Origin: https://provider.ltd
Host: provider.ltd
Accept: application/json, text/javascript, */*; q=0.01
Connection: keep-alive
Accept-Encoding: br, gzip, deflate
Accept-Language: en-us
DNT: 1
Cookie: PHPSESSID=xxyxyxyxyxyxyxyyxyyyxy
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Safari/605.1.15
Referer: https://provider.ltd/
Content-Length: 43
X-Requested-With: XMLHttpRequest

Response
HTTP/1.1 200 OK
Content-Type: application/json
Pragma: no-cache
Date: Tue, 05 Jun 2018 10:29:04 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Server: Apache/2.2.22 (Debian)
Content-Length: 0
X-Powered-By: PHP/5.4.45-0+deb7u2
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Connection: Keep-Alive
Keep-Alive: timeout=10, max=10000
Set-Cookie: login=+; expires=Tue, 05-Jun-2018 09:29:04 GMT; path=/; domain=lk.provider.ltd; secure; httponly
Set-Cookie: password=+; expires=Tue, 05-Jun-2018 09:29:04 GMT; path=/; domain=lk.provider.ltd; secure; httponly

Request Data
MIME Type: application/x-www-form-urlencoded; charset=UTF-8
username: someuser
password: somepass
Can i use it?
I tried
/tool fetch http-method=post http-data="{\"username\":\"someuser\"\n\"password\":\"somepass\"}" url="https://provider.ltd/path-to-script.php"
But it doesn't work for me.
 
User avatar
dasiu
Trainer
Trainer
Posts: 232
Joined: Fri Jan 30, 2009 11:41 am
Location: Reading, UK
Contact:

Re: Help me with fetch

Tue Jun 05, 2018 7:21 pm

Have you tried:
/tool fetch http-method=post http-data="payload={\"username\":\"someuser\"\n\"password\":\"somepass\"}" url="https://provider.ltd/path-to-script.php"
?

Or maybe:
/tool fetch http-method=post http-data="username=someuser&password=somepass" url="https://provider.ltd/path-to-script.php"
?
 
pafflootiy
just joined
Topic Author
Posts: 10
Joined: Tue Sep 23, 2014 10:27 am

Re: Help me with fetch

Wed Jun 06, 2018 9:08 am

Have you tried:
/tool fetch http-method=post http-data="payload={\"username\":\"someuser\"\n\"password\":\"somepass\"}" url="https://provider.ltd/path-to-script.php"
?

Or maybe:
/tool fetch http-method=post http-data="username=someuser&password=somepass" url="https://provider.ltd/path-to-script.php"
?
Tried both.

Who is online

Users browsing this forum: No registered users and 12 guests