Hey @BostonJames - stepping back a bit I think we can skip the addslashes method all together.
Using our PHP quickstart as a baseline, I made a few modifications which allowed me to upload updates through the GraphQL API without any hiccups.
In this example I’m using the $input variable since I was manually entering different variables on the terminal, but you can replace it for a pre-determined string. The biggest change was declaring the variables on the query portion of the query so that json_encode would be able to process it.
echo "What do you want to input? ";
$input = rtrim(fgets(STDIN));
$query = 'mutation ($myUpdate: String!) { create_update (item_id: xxxx, body:$myUpdate) {id}}';
$vars = ['myUpdate' => $input];
And then you would just need to modify the last line of the $data portion to json_encode / send your variables as well as the query: