How can I spoof the sender IP address using curl?

For my own purposes, changing the HTTP header was enough, via the following:

curl --header "X-Forwarded-For: 1.2.3.4" "http://www.foobar.com"

You can't.

In general, spoofing IP addresses for TCP is remarkably difficult. Unless you have control of a router quite near your target or near the IP you're spoofing, consider it impossible.

The reply packets need a path back to you in order to complete even the three-way handshake. The most reliable way to do this is to have control over a router in the most common pathway between your target and your spoofed IP address: this would let you capture packets between the target and the spoofed address and forward them on to you.

You could also try injecting bogus BGP route advertisements, but doing so would doubtless be noticed and cost you dearly when your peers drop you completely.