Cannot upload image


#1

Hi,

I’m trying to send a tweet (on PHP, using the REST API), with images attached and I can’t seem to attch the images.
The tweet creates successfully, but without any images.

I’m using CURL with this code:

$feed = curl_init();
    curl_setopt_array($feed, $options);
    $json = curl_exec($feed);
    curl_close($feed);

And this is the $options array (I replaced my keys with 5 dots)

array(6) {
  [10023] =>
  array(2) {
    [0] =>
    string(296) "Authorization: OAuth oauth_consumer_key=".....", oauth_nonce=".....", oauth_signature_method="HMAC-SHA1", oauth_token=".....", oauth_timestamp="1416223966", oauth_version="1.0", oauth_signature=".....""
    [1] =>
    string(7) "Expect:"
  }
  [42] =>
  bool(false)
  [10002] =>
  string(48) "https://api.twitter.com/1.1/statuses/update.json"
  [19913] =>
  bool(true)
  [13] =>
  int(10)
  [10015] =>
  array(3) {
    'media_ids' =>
    string(75) "534307946650296322,534307952618790912,534307958817964032,534307965088448512"
    'status' =>
    string(6) "Texttosend"
    'trim_user' =>
    int(1)
  }
}

However, when I do it with twurl tool with this command (and with the ID’s of previously uploaded images), it works:

twurl "/1.1/statuses/update.json" -d "media_ids=534300600507576321&status=sdfgdfgfgdfghdfh&trim_user=1"

Any help would be appreciated! Thank you.