1

I want to post an image on twitter but I can't. I am able to post only text message with twitter API.

The error is: Error: Server error: couldn't open file "Capture.png"

I use wamp server. The picture is in the same folder with the script.

Where is the problem?

require_once '../src/twitter.class.php';

// ENTER HERE YOUR CREDENTIALS (see readme.txt)
$twitter = new Twitter. ('raQBedybFLb', 'HWgN6Qt11jg0LY', '862846056-ndeGfMA83r9ldh', 'VMBvHDahXnGp');
$p='./Capture.png';
try {
$tweet = $twitter->send('testing twitter api', $p); // you can add $imagePath as second argument

} catch (TwitterException $e) {
echo 'Error: ' . $e->getMessage();
}
CCA
  • 39
  • 7

1 Answers1

0

You may use $p = realpath('Capture.png');

Floern
  • 33,559
  • 24
  • 104
  • 119
sum1
  • 1