I am trying to post a message through cURL but I keep getting an error:
{"error":{"message":"(#1500) The url you supplied is invalid","type":"OAuthException","code":1500}}
Here is my code:
$this->msgData['message'] .= 'Test Message';
$this->msgData['link'] = 'test Link';
$this->msgData['name'] = 'Ny test Name';
$this->msgData['access_token'] = 'myaccesstoken';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/'.$this->page_id.'/feed');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
// execute and close
$return = curl_exec($ch);
curl_close($ch);
I know that the offline access token has been deprecated but you can still use it by disabling "Remove offline_access permission" in app setting.
I have researched online but I couldn't find much info why this is failing. What URL it means when it says that the URL supplied is invalid? Is the "link" of the CURL URL?
Any suggestions guys?