[請益] cURL 和 POST
各位先進好, 小弟最近在研究使用 cURL 將值 POST 給遠端的一個網頁.
遠端的網頁將傳遞的值處理過後, 我再將處理結果收回.
目前已經順利將值 POST 到遠端網頁, 但是...卻一直收不到對方處理結果 :(
因此希望能跟板上的先進請教, 看看是不是程式撰寫上有誤, 非常感謝 :)
小弟我的執行狀況: http://140.133.8.153/~yenning/test/test3.php
執行成功的圖片: http://140.133.8.153/~yenning/test/test.jpg

以下是小弟的程式
$data1='測試';
$data2='測試文字';
$title = mb_convert_encoding($data1,"utf-8","big5");
$text = mb_convert_encoding($data2,"utf-8","big5");
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,
"http://www.lsa.url.tw/modules/lsa/lsa_writing_evaluation.php");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_USERAGENT, "Google Bot");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_POSTFIELDS, 'txt_title='.
$title .'&mytext='. $text .'');
$output = curl_exec($ch);
curl_close($ch);
echo $output;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.133.12.197
※ 編輯: yenning 來自: 140.133.12.197 (04/20 13:54)
推
04/20 23:14, , 1F
04/20 23:14, 1F
→
04/20 23:15, , 2F
04/20 23:15, 2F
→
04/20 23:16, , 3F
04/20 23:16, 3F
→
04/20 23:17, , 4F
04/20 23:17, 4F
→
04/20 23:17, , 5F
04/20 23:17, 5F
→
04/20 23:27, , 6F
04/20 23:27, 6F
→
04/20 23:27, , 7F
04/20 23:27, 7F
→
04/20 23:38, , 8F
04/20 23:38, 8F
→
04/20 23:39, , 9F
04/20 23:39, 9F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章