OBiTALK Community

General Support => Day-to-Day Use => Topic started by: ukuser on May 13, 2013, 08:48:28 am



Title: Scripting Obi110
Post by: ukuser on May 13, 2013, 08:48:28 am
I want to change
Physical Interfaces >LINE Port > InboundCallRoute
on my Obi110 from a shell script (under Linux).
If I enter this url:
http://admin:admin@obihai/result.html?fecc8d44={12345:},{ph}
in a browser (Firefox) it works fine.

If I try the same using wget (or curl for that matter) eg :
wget 'http://admin:admin@obihai/result.html?fecc8d44={123456:},{ph}'
it changes InboundCallRoute alright but it's urlencoded and looks like this:
%7B123456:%7D,%7Bph%7D
which isn't going to work!
Using wget --post-data option does exactly the same thing.
Anyone got any thoughts please?


Title: Re: Scripting Obi110
Post by: corporate_gadfly on May 13, 2013, 11:56:51 am
Shot in the dark, but have you tried cURL (http://curl.haxx.se/docs/manpage.html) with the -F (http://stackoverflow.com/questions/10765243/how-can-i-rewrite-this-curl-multipart-form-data-request-without-using-f) flag?

From wget man page (wget only supports application/x-www-form-urlencoded):
Code:
      --post-data=string
       --post-file=file
           Use POST as the method for all HTTP requests and send the specified data in the request body.
           --post-data sends string as data, whereas --post-file sends the contents of file.  Other than
           that, they work in exactly the same way. In particular, they both expect content of the form
           "key1=value1&key2=value2", with percent-encoding for special characters; the only difference is
           that one expects its content as a command-line parameter and the other accepts its content from a
           file. In particular, --post-file is not for transmitting files as form attachments: those must
           appear as "key=value" data (with appropriate percent-coding) just like everything else. Wget does
           not currently support "multipart/form-data" for transmitting POST data; only
           "application/x-www-form-urlencoded". Only one of --post-data and --post-file should be specified.


Title: Re: Scripting Obi110
Post by: ukuser on May 13, 2013, 05:05:24 pm
Thanks for those suggestions corporate_gadfly !

but have you tried cURL with the -F flag?
No I hadn't - but I have now (as well as a few other data flags). Sadly, no difference.

wget only supports application/x-www-form-urlencoded
Indeed so and, according to Tamper Data, that is the way Firefox sends the data so I thought it should be OK.

The really annoying thing is wget works fine so long as there are no characters that need to be urlencoded in the data so
Code:
wget 'http://admin:admin@obihai/result.html?fecc8d44=ph'
works fine but
Code:
wget 'http://admin:admin@obihai/result.html?fecc8d44={ph}'

or (clutching at straws)
Code:
wget 'http://admin:admin@obihai/result.html?fecc8d44=%7Bph%7D'
don't.
I'm sure I'm missing something obvious!