So after some fiddling with your code, I got it to work: I think part of the problem was that you can't use URLs to the image (like you were doing).
Anyway, the following code (see pastebin link) gives examples of how to do it with File Uploading through a form, or just using canned local images from your server. http://pastebin.com/f6eb4650c Hope this helps, -Chad On Tue, Jan 6, 2009 at 3:15 PM, Stuart <[email protected]> wrote: > > 2009/1/6 James N. Weber <[email protected]>: >> >> Thanks for the help, Chad. I think I need the PHP equivalent of -F in >> curl- I'm not sure how to set that. >> >> I tried changing it to CURLOPT_POSTFIELDS, and Twitter gave me a >> "Something is technically wrong." page- the robot lobster with a >> broken claw. >> Any ideas? > > The code I took the below line from is not uploading an image to > Twitter, but rather between two internal servers on one of the sites I > maintain and it works fine for me... > > curl_setopt($ch, CURLOPT_URL, $url); > curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: ')); > curl_setopt($ch, CURLOPT_POST, 1); > curl_setopt($ch, CURLOPT_POSTFIELDS, array('img' => '@'.$filename)); > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); > $result = curl_exec($ch); > > Hope it helps you. > > -Stuart > > -- > http://stut.net/ >
