Hi,
As part of a Twitter Application I'm working on, I need to send a
direct message to a user. My code for this is:
<?
$twitterHost = "http://twitter.com/direct_messages/new.format";
$postdata = array("user" => $Username, "text" => "MESSAGE I AM
SENDING");
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $twitterHost);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERPWD, $APIusername . ":" .
$APIpassword);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
set_time_limit(60); // Keep script from timing out
$APIResult = curl_exec($curl);
curl_close($curl);
echo $APIResult;
?>
$APIusername and $APIpassword are my Twitter Username and Password.
(I've been whitelisted.) The response I get back is: "403 Forbidden:
The server understood the request, but is refusing to fulfill it."
What could be causing this error and how can I fix it?