cURL / Mailing Lists / curl-users / Single Mail

curl-users

Problem with curl fetches in a batch file

From: Jan Schmidtbauer <janschmidtbauer_at_googlemail.com>
Date: Sat, 20 Feb 2010 18:15:19 +0100

Hello,
I'd like to use curl's POST method to configure my router with the help
of some batch files (WinXP).
My router is using SIDs as a security feature. Therefore I use a first
curl-command in my batch file to get a valid SID and save it into the
variable %SID%.

In the second step I'd like to use this SID in another fetch of curl to
configure my router.

Doing all this step by step on the command line it works. However,
writing it into a batch file it fails.

Here is my batch file:

@echo off

echo Beginning configuration

rem getting an SID and saving it to %SID%
for /f "tokens=2 delims=<>" %%i in ('curl
"http://fritz.box/cgi-bin/webcm?getpage=../html/login_sid.xml"^|Find /i
"SID"') do @set SID=%%i
echo Your SID is %SID%

rem a pause for 3000ms
echo wait 3000ms ...
ping 1.1.1.1 -n 1 -w 3000 >nul

rem using the SID in another curl-command
rem curl "http://fritz.box/cgi-bin/webcm" -d
"sid=%SID%&connection0%3Asettings%2Fcmd_disconnect="

Hope you can help me,
thanks in advance.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-20