Thanks Chad it was the content type, I made a quick function to grab
the mime type as the avatar is randomly selected from a folder and
changed my postfields as follows:

curl_setopt($curl_handle, CURLOPT_POSTFIELDS, array("image" => "@
$avatar", "type" => "$mime_type"));

All seems to be working now,
thanks for the push!

On Oct 14, 11:10 pm, Chad Etzel <c...@twitter.com> wrote:
> Most likely the content-type is not being set correctly. What is the
> value of $new_image?
> -Chad
>
> On Wed, Oct 14, 2009 at 10:29 PM, TylerC <tyle...@gmail.com> wrote:
>
> > Hey all I am having trouble getting Twitter to update profile
> > avatars... From what I can tell I have the API calls straight but when
> > I go to Twitter there is no avatar image and when I right click it and
> > then click view image I get the following:
>
> > <Error>
> > <Code>AccessDenied</Code>
> > <Message>Access Denied</Message>
> > <RequestId>5C34DBD155FA0052</RequestId>
> > -
> > <HostId>
> > Rd/SKr0AUrZiiT3K0jLhhVZ3EpVqWRKbP8NSlc26gQn21WIqkl7E9roK/ZaUFEfg
> > </HostId>
> > </Error>
>
> > Here is my API call, the image being sent is a gif much smaller than
> > 700kb and its the absolute path...
>
> > $url = 'http://twitter.com/account/update_profile_image.xml';
>
> > $curl_handle = curl_init();
>
> > curl_setopt($curl_handle, CURLOPT_URL, "$url");
>
> > curl_setopt($curl_handle, CURLOPT_POST, 1);
>
> > curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Expect:'));
>
> > curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
>
> > curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
>
> > curl_setopt($curl_handle, CURLOPT_POSTFIELDS, array("image" => "@
> > $new_image"));
>
> > curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
>
> > $buffer = curl_exec($curl_handle);
>
> > curl_close($curl_handle);
>
> > echo $buffer;
>
> > Everything is returned properly with no errors but yet no image
> > appears for the avatar just a blank space. Oddly enough the image name
> > on the profile page is correct but it will not show...
>
> > Any ideas this is really pissing me off!?
>
> > Thanks!

Reply via email to