[請益] 使用POST方式將資料貼至ssl網站

看板PHP作者 (蘇打)時間19年前 (2006/04/02 19:41), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
我想作自動登入的程式(具有ssl的server) 在網址列上打入"https://xxx.xxx.xxx.xxx/xxx.asp?user=xxx&pwd=xxx 這樣的方式是可以login的 我嘗試將他寫成php但似乎有問題,得不到結果 <? $pw = "user=xxx&pwd=xxx"; $url = "some url"; $user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"; $tmp = curl_init(); curl_setopt($tmp, CURLOPT_POST, 1); curl_setopt($tmp, CURLOPT_POSTFIELDS, $pw ); curl_setopt($tmp, CURLOPT_URL, $url); curl_setopt($tmp, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($tmp, CURLOPT_USERAGENT, $user_agent); curl_setopt($tmp, CURLOPT_RETURNTRANSFER, 1); curl_setopt($tmp, CURLOPT_HEADER, 1); $content = curl_exec($tmp); echo $content; curl_close($tmp); ?> 請問上面的寫法有錯誤嗎@@? 跑完後沒有顯示任何畫面 if( $content = curl_exec($tmp) )也回傳false 對curl不太熟悉,煩請賜教 謝謝m(_ _)m -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.10.1.56
文章代碼(AID): #14BxXnrV (PHP)
文章代碼(AID): #14BxXnrV (PHP)