I am trying to find out if a curl call was successful or not in php, the equivalent in bash would be:
`eval curl -f --data $payload http://localhost/service`
if [ $? -ne 0 ]; then
echo passed
else
echo failed
fi
so far I have this in php but it does not work:
`eval curl -f --data $PAYLOAD "http://localhost/service"`;
if ( $? == 0 )
echo fail;
else
echo passed;
however I get the following error PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) or '$'
the payload looks like the folioing:
$PAYLOAD="'payload={
\"firstname\":\"$firstname\",
\"id\":\"$id\",
\"author_lastname\":\"$lastname\"
}' "
thanks in advance!