News:

On Tuesday September 6th the forum will be down for maintenance from 9:30 PM to 11:59 PM PDT

Main Menu

Scripting Obi110

Started by ukuser, May 13, 2013, 08:48:28 AM

Previous topic - Next topic

ukuser

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?

corporate_gadfly

#1
Shot in the dark, but have you tried cURL with the -F flag?

From wget man page (wget only supports application/x-www-form-urlencoded):
      --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.

ukuser

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
wget 'http://admin:admin@obihai/result.html?fecc8d44=ph'
works fine but
wget 'http://admin:admin@obihai/result.html?fecc8d44={ph}'
or (clutching at straws)
wget 'http://admin:admin@obihai/result.html?fecc8d44=%7Bph%7D'
don't.
I'm sure I'm missing something obvious!