PHP restart Orange Funbox 2.0 internet - php
Exact model: Sagemcom CS 50001
I was trying to write a script in PHP/CURL to automatically reset internet in Orange FunBox, but it doesn't work... login seems to work fine, as well as session... because when login fails, I get error in response to restart command... "Access denied"... ok... but now there is no error, response the same as in browser, but restart doesn't take place... any idea why?
Step one: Login.
$useragent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1";
$curl = curl_init('http://192.168.1.1/authenticate?username=admin&password=admin');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
curl_setopt($curl, CURLOPT_POSTFIELDS,'username=admin&password=admin');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_COOKIESESSION, true);
curl_setopt($curl, CURLOPT_COOKIEJAR, '/tmp/ipreset_cookie.jar');
curl_setopt($curl, CURLOPT_COOKIEFILE, '/tmp/ipreset_cookie.txt');
Step two: Send connection restart request.
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/x-sah-ws-1-call+json; charset=UTF-8','X-Context:'.$context,'X-Prototype-Version:1.7','X-Requested-With:XMLHttpRequest','Referer:http://192.168.1.1/advConfigAccessType.html'));
curl_setopt($curl, CURLOPT_URL, 'http://192.168.1.1/sysbus/NeMo/Intf/data:setFirstParameter');
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, '{"parameters":{"name":"Enable","value":1,"flag":"ppp","traverse":"down"}}');
curl_setopt($curl, CURLINFO_HEADER_OUT, true);
curl_exec($curl);
What I am getting is an answer that status:null, no error (the same answer as in browser when it works)... but nothing happens.
The problem may be the way that CURL encodes the POST, but not sure about it... normally by browser it is send in payload.
Second idea is that when in browser, it sends some mass of requests to different interfaces, and cookies are much bigger than session id... someting like:
46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl;46db1eb1/context=$context; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl;'
The problem is that I can't add that in CURL without losing session cookie... when I add Cookie header with that, it adds second Cookie header in request... and I guess it's wrong.
The funny is that... when I copy to CURL command line a request to restart connection (from Browser), curl gives me Gateway timeout error... pretty weird, as same request worked before from browser...
This is what Fiddler returns as CURL script export from whole procedure (since login to restart). Maybe it will help...
curl -k -i --raw -o 0.dat "http://192.168.1.1/" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Accept-Encoding: gzip, deflate, lzma, sdch" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "If-None-Match: 46db1eb1"
curl -k -i --raw -o 1.dat "http://192.168.1.1/" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Accept: */*" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma, sdch" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl" -H "If-None-Match: 46db1eb1"
curl -k -i --raw -o 2.dat -X POST "http://192.168.1.1/sysbus/UserInterface:getLanguage" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Accept: text/javascript, text/html, application/xml, text/xml, */*" -H "X-Prototype-Version: 1.7" -H "Origin: http://192.168.1.1" -H "X-Requested-With: XMLHttpRequest" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1"
curl -k -i --raw -o 3.dat -X POST "http://192.168.1.1/sysbus/Devices:get" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "X-Sah-Request-Type: idle" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1"
curl -k -i --raw -o 4.dat -X POST "http://192.168.1.1/sysbus/eventmanager:get_events" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: null" -H "Content-type: application/x-sah-ws-4-call+json; charset=UTF-8" -H "Accept: text/javascript, text/html, application/xml, text/xml, */*" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "X-Sah-Request-Type: idle" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl"
curl -k -i --raw -o 5.dat -X POST "http://192.168.1.1/sysbus/NMC/OrangeTV:getIPTVStatus" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "X-Sah-Request-Type: idle" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl"
curl -k -i --raw -o 6.dat -X POST "http://192.168.1.1/sysbus/VoiceService/VoiceApplication:listTrunks" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "X-Sah-Request-Type: idle" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl"
curl -k -i --raw -o 7.dat -X POST "http://192.168.1.1/sysbus/NMC:getWANStatus" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "X-Sah-Request-Type: idle" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl"
curl -k -i --raw -o 8.dat -X POST "http://192.168.1.1/sysbus/NMC/Wifi:get" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "X-Sah-Request-Type: idle" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl"
curl -k -i --raw -o 9.dat -X POST -d "username=admin&password=admin" "http://192.168.1.1/authenticate?username=admin&password=admin" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Accept: text/javascript, text/html, application/xml, text/xml, */*" -H "X-Prototype-Version: 1.7" -H "Origin: http://192.168.1.1" -H "X-Requested-With: XMLHttpRequest" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Content-type: application/x-www-form-urlencoded; charset=UTF-8" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl"
curl -k -i --raw -o 10.dat "http://192.168.1.1/advConfigNetworkDhcp.html" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Referer: http://192.168.1.1/" -H "Accept-Encoding: gzip, deflate, lzma, sdch" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:25 GMT+0100 (Środkowoeuropejski czas stand.)" -H "If-None-Match: 46db1eb1"
curl -k -i --raw -o 11.dat "http://192.168.1.1/advConfigNetworkDhcp.html" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Accept: */*" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma, sdch" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:25 GMT+0100 (Środkowoeuropejski czas stand.); 46db1eb1/accept-language=pl-PL,pl" -H "If-None-Match: 46db1eb1"
curl -k -i --raw -o 12.dat -X POST "http://192.168.1.1/sysbus/UserManagement:getUsers" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 13.dat -X POST "http://192.168.1.1/sysbus/NMC:getLANIP" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 14.dat -X POST "http://192.168.1.1/sysbus/Devices:get" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 15.dat -X POST "http://192.168.1.1/sysbus/DHCPv4/Server/Pool/default:getStaticLeases" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 16.dat -X POST "http://192.168.1.1/sysbus/NMC:getWANStatus" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 17.dat -X POST "http://192.168.1.1/sysbus/Devices:get" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 18.dat "http://192.168.1.1/advConfigAccessType.html" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Referer: http://192.168.1.1/advConfigNetworkDhcp.html" -H "Accept-Encoding: gzip, deflate, lzma, sdch" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.)" -H "If-None-Match: 46db1eb1"
curl -k -i --raw -o 19.dat "http://192.168.1.1/advConfigAccessType.html" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "Accept: */*" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma, sdch" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:31 GMT+0100 (Środkowoeuropejski czas stand.); 46db1eb1/accept-language=pl-PL,pl" -H "If-None-Match: 46db1eb1"
curl -k -i --raw -o 20.dat -X POST "http://192.168.1.1/sysbus/UserManagement:getUsers" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:33 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 21.dat -X POST "http://192.168.1.1/sysbus/NMC:getWANStatus" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:34 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 22.dat -X POST "http://192.168.1.1/sysbus/NeMo/Intf/data:getMIBs" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:34 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 23.dat -X POST "http://192.168.1.1/sysbus/NeMo/Intf/data:setFirstParameter" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:36 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 24.dat -X POST "http://192.168.1.1/sysbus/NeMo/Intf/data:setFirstParameter" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:37 GMT+0100 (Środkowoeuropejski czas stand.)"
curl -k -i --raw -o 25.dat -X POST "http://192.168.1.1/sysbus/NMC:getWANStatus" -H "Host: 192.168.1.1" -H "Connection: keep-alive" -H "Origin: http://192.168.1.1" -H "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36 OPR/34.0.2036.25" -H "X-Context: AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl" -H "Content-type: application/x-sah-ws-1-call+json; charset=UTF-8" -H "Accept: text/javascript" -H "X-Prototype-Version: 1.7" -H "X-Requested-With: XMLHttpRequest" -H "Referer: http://192.168.1.1/advConfigAccessType.html" -H "Accept-Encoding: gzip, deflate, lzma" -H "Accept-Language: pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" -H "Cookie: 46db1eb1/zoom-accessibility=small; 46db1eb1/contrast-accessibility=contrast1; 46db1eb1/language=pl; 46db1eb1/possibleLanguages=en,pl; 46db1eb1/sessid=MQcSNORlUtoe+b3DDwwgwuhk; 46db1eb1/context=AQ0BPWb8JMpzvU0gKzBTouV7eHtd6mNv3KWHvVD5xSuTBrXbPoT4HEZL0hM5tnnl; 46db1eb1/login=admin; 46db1eb1/accept-language=pl-PL,pl; 46db1eb1/expirydate=Wed Dec 23 2015 15:04:42 GMT+0100 (Środkowoeuropejski czas stand.)"
Note that /sysbus/NeMo/Intf/data:setFirstParameter is invoked twice. In my case:
the first one is with {name: "Enable", value: 0, flag: "ppp", traverse: "down"}
the second one, right after the first one, with {name: "Enable", value: 1, flag: "ppp", traverse: "down"}
(Note the difference in value)
What happens if you try both requests?
Another way, probably more convenient to a casual reader of this question, is to use the sysbus.py script by René D. Février.
First, you need to configure it like described in the README (in french, but Google translate works well enough here), and then do something like:
./sysbus.py NeMo.Intf.data:setFirstParameter name=Enable value=0 flag=ppp traverse=down
./sysbus.py NeMo.Intf.data:setFirstParameter name=Enable value=1 flag=ppp traverse=down
This post is several years old, but I confirm having the same model (Funbox 2.0, Model: Sagemcom CS 50001) and have figured it out in bash -
#!/bin/bash
cookie=`mktemp /dev/shm/curl.XXXXXXXXXX`
res=`curl "http://192.168.1.1/authenticate?username=$USER&password=$PASSWORD" --cookie-jar "$cookie" --data '' 2>/dev/null`
context=`python3 -c 'import json; d = json.loads("""'"$res"'"""); print(d["data"]["contextID"])'`
curl -s -X POST -H "Content-Type: application/json" \
-H "X-Context: $context" --cookie "$cookie" -d '{"parameters":{}}' \
"http://192.168.1.1/sysbus/NMC:reboot"
rm "$cookie"
Essentially you have to set the session, get the Context ID and use it in the second command to actually reboot the router.
Related
cURLnot working properly from PHP or CRON
I have nn.sh #/bin/sh cd /var/www/html /usr/bin/curl 'https://web-api.wtnnip.com/app' \ -H 'authority: web-api.wtnnip.com' \ -H 'accept: */*' \ -H 'accept-language: ro-RO,ro;q=0.9,en-US;q=0.8,en;q=0.7' \ -H 'content-type: application/json' \ -H 'origin: https://www.wtnnip.com' \ -H 'referer: https://www.wtnnip.com/ro-RO/non-professional' \ -H 'sec-ch-ua: "Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Linux"' \ -H 'sec-fetch-dest: empty' \ -H 'sec-fetch-mode: cors' \ -H 'sec-fetch-site: same-site' \ -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36' \ --compressed If I execute the file is working fine. If I copy cURL command and run in terminal, is working fine. Working fine means I receive the json collection. But if I set crontab to run this file, or I run the file from PHP with exec or passthru I receive this error: {"errors" : [ { "message" : "Invalid JSON payload in GraphQLAuth POST request.", "errorType" : "MalformedHttpRequestException" } ] } I also try to write a code and use the cURL directly from PHP, but I receive the same error. How can I run this from cron or php? Thanks! LE: I use Debian 11, PHP 7.4 and cURL 7.74 I have bash as shell, I try with #/bin/bash as well SOLVED #!/bin/bash in first line I forgot the exclamation mark. Thanks to Ulrich Eckhardt for light!
#!/bin/sh cd /var/www/html || exit If you want to try PHP, Try this: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://web-api.wtnnip.com/app'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET'); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'authority' => 'web-api.wtnnip.com', 'accept' => '*/*', 'accept-language' => 'ro-RO,ro;q=0.9,en-US;q=0.8,en;q=0.7', 'content-type' => 'application/json', 'origin' => 'https://www.wtnnip.com', 'referer' => 'https://www.wtnnip.com/ro-RO/non-professional', 'sec-ch-ua' => '"Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"', 'sec-ch-ua-mobile' => '?0', 'sec-ch-ua-platform' => '"Linux"', 'sec-fetch-dest' => 'empty', 'sec-fetch-mode' => 'cors', 'sec-fetch-site' => 'same-site', 'user-agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36', 'Accept-Encoding' => 'gzip', ]); $response = curl_exec($ch); curl_close($ch);
How to get the particular data set from curl response
I'm trying to get the rcmDriverAgesInfo data from this curl 'https://apis.rentalcarmanager.com/booking/v3.1/API_KEY/step2/0/5/17_11_2021/11_00/5/23_11_2021/11_00/2/0/-/-?apikey=API_KEY' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: image/webp,*/*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Connection: keep-alive' -H 'Cookie: PHPSESSID=dksko0e9vkcuggi7lk7o94eaq1' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: Trailers' And This is my code <? $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://apis.rentalcarmanager.com/booking/v3.1/API_KEY=/step2/0/5/25_10_2021/11_00/5/30_10_2021/11_00/2/0/-/-?apikey=API_KEY=", CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 30000, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( // Set Here Your Requesred Headers 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0', 'Accept: image/webp,*/*', 'Content-Type: application/json', 'charset=UTF-8', 'Accept-Language: en-US,en;q=0.5', 'Connection: keep-alive', 'Cookie: PHPSESSID=dksko0e9vkcuggi7lk7o94eaq1', 'Pragma: no-cache', 'Cache-Control: no-cache', ), ) ); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); print_r($response,1); This is curl output: rcmLocationInfo = [{"id":"13","location":"ADELAIDE - 192 ONKAPARINGA VALLEY RD, WOODSIDE","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"2","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"0417 816 649","email":"woodside#deluxecamper.com.au","minbookingday":"0"},{"id":"4","location":"AIRLIE BEACH - 1678 SHUTE HARBOUR RD","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"0749483415","email":"tropicaccounts#whitsunday.net.au","minbookingday":"0"},{"id":"2","location":"BRISBANE - 40 FRENCH STREET EAGLE FARM","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"07 5575 5400","email":"info#fivestarcarrentals.com.au","minbookingday":"0"},{"id":"1","location":"CAIRNS - 440 SHERIDAN STREET CAIRNS","webdefault":"True","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"+6140813100","email":"sales#campermanaustralia.com","minbookingday":"0"},{"id":"12","location":"GOLDCOAST - 2/11 Northview St,Mermaid Wt","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"(07) 5572 0600","email":"enquiries#surfersrentacar.com.au","minbookingday":"0"},{"id":"6","location":"MELB - 273 Elizabeth Street Coburg","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"0393542945","email":"jpantonmotors#bigpond.com","minbookingday":"0"},{"id":"5","location":"SYDNEY - 23-25 ERSKINE RD CARINGBAH","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"14:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"02 9540 5066","email":"sales#getacarrentals.com","minbookingday":"0"},{"id":"3","location":"TOWNSVILLE - 167 Mount Low Parkway, MOUNT LOW, QLD","webdefault":"False","pickupavailable":"True","dropoffavailable":"True","flightnoreqd":"False","noticerequired":"0","daysquotevalid":"7","officeopeningtime":"09:00","officeclosingtime":"16:00","afterhourbooking":"True","unattendeddropoffs":"True","minimunage":"18","afterhourfeeid":"309","unattendeddropofffeesid":"0","phone":"0407191437","email":"sales#campermanaustralia.com","minbookingday":"0"}]; rcmOfficeTimes = [{"locid":"1","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"1","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"1","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"1","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"1","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"1","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"1","wd":"7","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"00:00","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"2","wd":"7","afterhour":"True","unattended":"True","openingtime":"08:30","closingtime":"11:00","amstart":"00:00","amend":"08:25","pmstart":"11:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"3","wd":"7","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"12:00","amstart":"00:00","amend":"00:00","pmstart":"12:00","pmend":"15:00","startpickup":"00:00","endpickup":"15:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"4","wd":"7","afterhour":"True","unattended":"True","openingtime":"08:30","closingtime":"11:00","amstart":"00:00","amend":"08:25","pmstart":"11:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"1","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"12:00","amstart":"00:00","amend":"00:00","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"19:00","startpickup":"00:00","endpickup":"19:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:00","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"5","wd":"7","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"12:00","amstart":"00:00","amend":"00:00","pmstart":"12:00","pmend":"15:00","startpickup":"00:00","endpickup":"15:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"18:00","startpickup":"00:00","endpickup":"18:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"18:00","startpickup":"00:00","endpickup":"18:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"18:00","startpickup":"00:00","endpickup":"18:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"18:00","startpickup":"00:00","endpickup":"18:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"00:00","pmstart":"16:00","pmend":"18:00","startpickup":"00:00","endpickup":"18:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"6","wd":"7","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"12:00","amstart":"00:00","amend":"00:00","pmstart":"12:00","pmend":"15:00","startpickup":"00:00","endpickup":"15:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"12","wd":"7","afterhour":"True","unattended":"True","openingtime":"08:30","closingtime":"11:00","amstart":"00:00","amend":"08:25","pmstart":"11:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"1","afterhour":"True","unattended":"True","openingtime":"00:00","closingtime":"00:00","amstart":"00:00","amend":"23:55","pmstart":"00:00","pmend":"00:00","startpickup":"00:00","endpickup":"00:00","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"2","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"3","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"4","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"5","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"6","afterhour":"True","unattended":"True","openingtime":"09:00","closingtime":"16:00","amstart":"00:00","amend":"08:55","pmstart":"16:00","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"},{"locid":"13","wd":"7","afterhour":"True","unattended":"True","openingtime":"08:30","closingtime":"11:00","amstart":"00:00","amend":"08:25","pmstart":"11:05","pmend":"23:55","startpickup":"00:00","endpickup":"23:55","startdropoff":"00:00","enddropoff":"24:00"}]; rcmCategoryTypeInfo = [{"id":"6","categorytype":"CamperVan","ordering":"c","rentingtype":"True","raimage":"","rate12hour":"True","ratepernight":""}]; rcmDriverAgesInfo = [{"id":"10","driverage":"18","defaultage":"False"},{"id":"2","driverage":"19","defaultage":"False"},{"id":"3","driverage":"20","defaultage":"False"},{"id":"4","driverage":"21+","defaultage":"False"}]; rcmLocationFees = [{"cattypeid":"6","loctypeid":"1","loctype":"pickup","locationid":"5","currencyname":"","currencysymbol":"$","locdate":"25 Oct 2021","loctime":"11:00","dwname":"Monday","days4minbookingdaycheck":"6","location":"SYDNEY - 23-25 ERSKINE RD CARINGBAH","locdateloctime":"11-Oct-2021","tstavailable":"1","ierrorcode":"0","availablemsg":"","iafterhourpickup":"0","iafterhourdropoff":"0","tstminbookingday":"0","flightnoreqd":"False"},{"cattypeid":"6","loctypeid":"2","loctype":"dropoff","locationid":"5","currencyname":"","currencysymbol":"$","locdate":"30 Oct 2021","loctime":"11:00","dwname":"Saturday","days4minbookingdaycheck":"6","location":"SYDNEY - 23-25 ERSKINE RD CARINGBAH","locdateloctime":"11-Oct-2021","tstavailable":"1","ierrorcode":"0","availablemsg":"","iafterhourpickup":"0","iafterhourdropoff":"0","tstminbookingday":"0","flightnoreqd":"False"}]; rcmAvailableCarDetails = []; rcmMandatoryFees = [{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"2","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""},{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"4","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""},{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"5","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""},{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"27","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""},{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"30","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""},{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"31","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""},{"cattypeid":"6","column1":"MandatoryFees","id":"414","locationid":"5","vehiclesizeid":"35","numofdays":"6","qty":"1","fees":"70.0000","name":"Administration Fee","type":"Fixed","maxprice":"0.0000","fee_cost":"70.00","stampduty":"False","gst":"True","percentagetotalcost":"False","excessfee":"0.0000","merchantfee":"False","fromage":"0","toage":"0","qtyapply":"False","extradesc":"","extradesc1":"","extradesc2":"","extradesc3":""}]; rcmOptionalFees = []; rcmInsuranceOptions = []; rcmKmCharges = []; rcmTaxInclusive=true;rcmTaxRate=0.100;rcmStateTax=0.000; rcmErrors = []; rcmStep2Ready("","",""); But I just want only rcmOfficeTimes data [{"id":"10","driverage":"18","defaultage":"False"},{"id":"2","driverage":"19","defaultage":"False"},{"id":"3","driverage":"20","defaultage":"False"},{"id":"4","driverage":"21+","defaultage":"False"}] I need the rcmOfficeTimes dataset from this response data. Anyone can help me
Post request working in Postman but not in php code(SSL_ERROR_SYSCALL)
I'm trying to make a simple curl post request using PHP code snippet from Postman. But when I'm trying to run it I get the following error: "OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054" In postman the request is working fine and I do get the json results. Here's an inline link for postman header and the postman body My php code is the following: $curl = curl_init(); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false); curl_setopt_array($curl, array( CURLOPT_URL => "https://www.oglasnik.hr/ajax/getNearBy", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 500, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"classifiedId\"\r\n\r\n3996266\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"bounds\"\r\n\r\n{\"east\":16.00793838500977,\"west\":15.977039337158205,\"north\":45.78652940999985,\"south\":45.773958941535355}\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", CURLOPT_HTTPHEADER => array( "Accept: application/json, text/javascript, */*; q=0.01", "Accept-Encoding: gzip, deflate, br", "Accept-Language: en-US,en;q=0.9", "Cache-Control: no-cache", "Connection: keep-alive", "Content-Length: 384", "Content-Type: application/x-www-form-urlencoded", "Cookie: cookieconsent_status=allow; ogl_visits^[0^]=a5cbwGRWU7YEC1LP6tKOVOzf6GIZzyU7dbry64BfNak4xygExIAj^%^2FkGWQ5azKqmznEHJVCF4ZfufdAaCugfPjPi8vX7CB8Gs^%^2F3OdX5RVvYjyfWKHUHboChkYfbURk6Ly", "Host: www.oglasnik.hr", "Origin: https://www.oglasnik.hr", "Postman-Token: 60eebbd3-ed26-4aed-ae32-f190353ce333,aa32ad1d-55c6-4fa6-928e-3309a497c36a", "Referer: https://www.oglasnik.hr/stanovi-najam/novi-zagreb-bundek-2-sobni-stan-55-m2-oglas-3996266", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36", "X-Requested-With: XMLHttpRequest", "cache-control: no-cache", "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; } UPDATE: With the tip from #Andrew I changed the CURLOPT_HTTPHEADER to: CURLOPT_HTTPHEADER => array( "Accept: application/json, text/javascript, */*; q=0.01", "Accept-Encoding: gzip, deflate, br", "Accept-Language: en-US,en;q=0.9", "Cache-Control: no-cache", "Connection: keep-alive", "Content-Type: application/x-www-form-urlencoded", "Cookie: cookieconsent_status=allow; ogl_visits^[0^]=a5cbwGRWU7YEC1LP6tKOVOzf6GIZzyU7dbry64BfNak4xygExIAj^%^2FkGWQ5azKqmznEHJVCF4ZfufdAaCugfPjPi8vX7CB8Gs^%^2F3OdX5RVvYjyfWKHUHboChkYfbURk6Ly", "Host: www.oglasnik.hr", "Origin: https://www.oglasnik.hr", "Referer: https://www.oglasnik.hr/stanovi-najam/novi-zagreb-bundek-2-sobni-stan-55-m2-oglas-3996266", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36", "X-Requested-With: XMLHttpRequest", "cache-control: no-cache", "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" ) And i'm getting the response! Unfortunately its only { "status": false } As it looks like I'm sending my post parameters wrong. Problem is that I need to send one integer parameter and one string as json, currently trying like this: $bounds = [ "east" => 16.00793838500977, "west" =>15.977039337158205, "north" =>45.78652940999985, "south" =>45.773958941535355 ]; $params = [ "classifiedId" => 3996266, "bounds" => json_encode($bounds) ]; and adding this parameter in curl_setopt_array: CURLOPT_POSTFIELDS => $params Final update: It worked! As #Andrew stated in the comments it worked using: CURLOPT_POSTFIELDS => http_build_query($params) so the final header is: curl_setopt_array($curl, array( CURLOPT_URL => "https://www.oglasnik.hr/ajax/getNearBy", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => http_build_query($params), CURLINFO_HEADER_OUT => true, CURLOPT_HTTPHEADER => array( "Accept: application/json, text/javascript, */*; q=0.01", "Accept-Encoding: gzip, deflate, br", "Accept-Language: en-US,en;q=0.9", "Cache-Control: no-cache", "Connection: keep-alive", "Content-Type: application/x-www-form-urlencoded", "Cookie: cookieconsent_status=allow; ogl_visits^[0^]=a5cbwGRWU7YEC1LP6tKOVOzf6GIZzyU7dbry64BfNak4xygExIAj^%^2FkGWQ5azKqmznEHJVCF4ZfufdAaCugfPjPi8vX7CB8Gs^%^2F3OdX5RVvYjyfWKHUHboChkYfbURk6Ly", "Host: www.oglasnik.hr", "Origin: https://www.oglasnik.hr", "Referer: https://www.oglasnik.hr/stanovi-najam/novi-zagreb-bundek-2-sobni-stan-55-m2-oglas-3996266", "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36", "X-Requested-With: XMLHttpRequest", "cache-control: no-cache", "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" ), ));
How do i convert this cURL command into PHP code? And what is "Request Payload"?
So, I was inspecting the network while I'm uploading an JPG image. A copy as a curl command : curl "https://admin-official.line.me/11702069/home/api/objects" -H "Origin: https://admin-official.line.me" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-US,en;q=0.9,id;q=0.8,de-DE;q=0.7,de;q=0.6" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBv1B9k1i89zlgjnA" -H "Accept: */*" -H "Referer: https://admin-official.line.me/11702069/home/send/" -H "Cookie: tzoffset=-420; _trmccid=6b030cba93d9db09; _ga=GA1.2.1058855825.1526457491; _gid=GA1.2.814129237.1526457491; ldsuid=CiDum1r75zWBJ3f7oLqRAg==; _trmcdisabled2=-1; _trmcuser=^{^\^"id^\^":^\^"^\^"^}; _ga=GA1.3.1058855825.1526457491; _gid=GA1.3.814129237.1526457491; plack_session_localaccount=XXX; minesota=XXX; minesota2=XXX-jdT5f_x10ov7Re12NliQw_zFyIe9osY4oOOc2Rxdy1gMyBhXbKdPmnpA2LHB9VhvlqlL_4hkeSNQK5SgU; plack_session=6cd2e4790ae9990303ea54f7f35b305fba801dc0; _trmcsession=^{^\^"id^\^":^\^"b8ba0724^\^",^\^"path^\^":^\^"/11702069/home/send/^\^",^\^"query^\^":^\^"^\^",^\^"time^\^":1526735963213,^\^"_dice^\^":0.09452730791211028^}; __try__=1526737592637; _trmcpage=/11702069/home/send/" -H "Connection: keep-alive" --data-binary ^"------WebKitFormBoundaryBv1B9k1i89zlgjnA^ Content-Disposition: form-data; name=^\^"file^\^"; filename=^\^"alpen.jpg^\^"^ Content-Type: image/jpeg^ ^ ^ ------WebKitFormBoundaryBv1B9k1i89zlgjnA^ Content-Disposition: form-data; name=^\^"csrf_token^\^"^ ^ vJiSf8AZPpAvqCp0JQtrNOMgrZRtrDpa1TEHbYLz^ ------WebKitFormBoundaryBv1B9k1i89zlgjnA--^ ^" --compressed I've never seen this before, i'm not an expert at curl. But I'm using curl to PHP coverter, but it's not working in this case. EDIT : here's what I've tried. <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://admin-official.line.me/11702069/home/api/objects"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, array("file" => "#".realpath('test.jpg'), "csrf_token" => $split2[0])); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate'); $headers = array(); $headers[] = "Origin: https://admin-official.line.me"; $headers[] = "Accept-Encoding: gzip, deflate, br"; $headers[] = "Accept-Language: en-US,en;q=0.9,id;q=0.8,de-DE;q=0.7,de;q=0.6"; $headers[] = "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36"; $headers[] = "Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBv1B9k1i89zlgjnA"; $headers[] = "Accept: */*"; $headers[] = "Referer: https://admin-official.line.me/11702069/home/send/"; $headers[] = 'Cookie: tzoffset=-420; _trmccid=6b030cba93d9db09; _ga=GA1.2.1058855825.1526457491; _gid=GA1.2.814129237.1526457491; ldsuid=CiDum1r75zWBJ3f7oLqRAg==; _trmcdisabled2=-1; _trmcuser={"id":""}; _ga=GA1.3.1058855825.1526457491; _gid=GA1.3.814129237.1526457491; plack_session_localaccount=XXX; minesota=XXX; minesota2=XXX; plack_session=XXX; _trmcsession={"id":"b8ba0724","path":"/11702069/home/send/","query":"","time":1526735963213,"_dice":0.09452730791211028}; __try__=1526737592637; _trmcpage=/11702069/home/send/'; $headers[] = "Connection: keep-alive"; curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch); echo $result; ?>
the "request payload" is the request body. a HTTP request is split into 2 parts, the headers, and the body (and Chrome calls the body for the request payload here, not sure if that's an official name, or just the whim of a chromium dev) anyway, you're using the # method, which was discouraged as of PHP 5.5, disabled-by-default in php 5.6, and completely removed in PHP7. use CURLFile instead, eg: curl_setopt($ch, CURLOPT_POSTFIELDS, array( "file" => new CURLFile('test.jpg'), "csrf_token" => $split2[0] )); also, don't set the Accept-Encoding header manually. you specify gzip, deflate, br, and curl doesn't support br, and depending on how libcurl was compiled, might not even support gzip/deflate (although it usually does), remove that. also, set CURLOPT_ENCODING to emptystring, and curl will list all encodings it was built to support (which is usually gzip and deflate, but is not guaranteed to be) also, when using the # or CURLFile method, don't set the Content-Type header manually, because if curl's boundary doesn't match what you set in the Content-Type header, the server won't be able to read the request properly. curl will set this header for you, if you don't override it, so don't.
Figure it out using Postman. $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://admin-official.line.me/11702069/home/api/objects", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( "csrf_token" => $split2[0], "file" => new CURLFile("test.jpg") ), //CURLOPT_POSTFIELDS => "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"csrf_token\"\r\n\r\nETukCyg_-OM72cZ0MuAyunvvy4cb8Cx2QqoP41T7\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--", CURLOPT_HTTPHEADER => array( "Accept: */*", "Accept-Encoding: gzip, deflate, br", "Accept-Language: en-US,en;q=0.9,id;q=0.8,de-DE;q=0.7,de;q=0.6", "Cache-Control: no-cache", "Connection: keep-alive", "Content-Type: multipart/form-data", "Cookie: tzoffset=-420; _trmccid=6b030cba93d9db09; _ga=GA1.2.1058855825.1526457491; _gid=GA1.2.814129237.1526457491; ldsuid=CiDum1r75zWBJ3f7oLqRAg==; _trmcdisabled2=-1; _trmcuser=^{^\^id^^:^\^^^^}; _ga=GA1.3.1058855825.1526457491; _gid=GA1.3.814129237.1526457491; plack_session_localaccount=COOKIE; minesota=COOKIE; minesota2=COOKIE; _trmcsession=^{^\^id^^:^\^36b6efe6^^,^\^path^^:^\^/11702069/home/send/^^,^\^query^^:^\^^^,^\^time^^:1526880852499,^\^_dice^^:0.4099096438552394^}; plack_session=519cce226206bd15cba86f2153c9dc91a56df4fb; _trmcpage=/11702069/home/send/; __try__=1526881572577", "Origin: https://admin-official.line.me", "Postman-Token: 8b9dc9c8-166a-4c50-93c4-b16ca72d72dc", "Referer: https://admin-official.line.me/11702069/home/send/", "User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36", //"content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" ), )); curl_setopt($curl, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($curl, CURLOPT_COOKIEFILE, 'cookie.txt'); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
Execute cUrl request
I'm new to php & cUrl's so I was wondering if someone knows how to get the following command executed using php. curl "http://www.mywebsite.com/index.php?action=confirm" -H "Origin: http://www.mywebsite.com" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" -H "Cache-Control: max-age=0" -H "Referer: http://www.mywebsite.com/index.php?action=confirm" -H "Connection: keep-alive" --data "confirmed=yes&id=14&from=&to=TestPerson" --compressed Thanks in advance and sorry if this beginner stuff. I'm just trying to learn
Rewrite like this.. <?php $ch = curl_init(); $curlconf = array( CURLOPT_URL => "http://www.mywebsite.com/index.php?action=confirm", CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => array( 'confirmed' => 'yes', 'id' => 14, 'from'=>'', 'to'=>'TestPerson', ) ); curl_setopt_array($ch, $curlconf); $result = curl_exec($ch); echo $result; curl_close($ch);
You have a PHP extension for that : http://www.php.net/manual/fr/curl.examples-basic.php