哪裏有和每個網站我看,他們說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