哪里有和每个网站我看,他们说wrong file path
导致这个错误,但我相信我的路径是正确的,它昨晚工作,为什么不今晚?PHP curl:创建formpost数据失败
为了证明路径是正确的,file_exists($path)
返回true
。
我想用Curl发送文件,我得到failed creating formpost data
。到文件,我给卷曲的路径是象下面这样:
define('ASSET_PATH', dirname(dirname(dirname(__FILE__))) . '/asset');
$postfields = array(
'chat_id' => $user->user_id,
'caption' => $asset->caption,
'duration' => $asset->duration,
'video' => "@" . ASSET_PATH . "/video/" . $asset->name,
);
当你看到的$postfields['video']
值时,输出为:
/home/hosseins/domains/my_domain/public_html/telegram/asset/video/Bottle_Bank.mp4
而且代码
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$result = curl_exec($ch);
echo curl_error ($ch); //return failed creating formpost data
echo '<br />' . ASSET_PATH . "/video/" . $asset->name; //return named path
curl_close($ch);
我的地址或问题来自哪里?有什么问题吗?
Dudes我卡在这里,任何帮助将不胜感激。
在此先感谢
嗨,我也使用sendVideo,但我有这个问题在这里:http://stackoverflow.com/questions/31961690/trying-to-send-user-video-from-telegram-bot-using-curl你有这样的问题吗? – MscEliot