Error: Server error: couldn't open file “Captu

2019-08-01 17:05发布

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();
}

1条回答
Explosion°爆炸
2楼-- · 2019-08-01 17:41

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

查看更多
登录 后发表回答