As long as you're not expecting to use valA and valB in future commands, you can use read
to store the the whitespace-delimited output from your exiting commands:
$ echo foo bar | { read var1 var2 ; echo $var1 $var2 ; }
foo bar
Which means you can do:
echo "value1" "value2" | { read a b ; curl --data 'valA=$a&valB=$b' http://example.com ; }