Been trying to get this to work for hours. Help would be greatly appreciated. userkey and sitekey are replaced with actual keys.
I'm trying to run in a php file:
$result = curl -X POST "https://www.mysite.org/sites/all/modules/civicrm/extern/rest.php?entity=Membership&action=get&api_key=userkey&key=sitekey&json={"sequential":1,"return":"membership_type_id,id,end_date","contact_id":2,"active_only":1,"options":{"limit":1,"sort":"join_date DESC"}}";
I get the error:
PHP Parse error: syntax error, unexpected 'POST' (T_STRING) in /home/spulver/civicrmapi.php on line 3
Any ideas how to fix?