Not RTFM is what you're doing wrong.

CURLOPT_URL
The actual URL to deal with. The parameter should be a char * to a zero terminated string.

A string is NOT a char * to a zero terminated string. However, x.c_str() is, so that would be the solution.