wget / PHP使用 curl函式庫 模擬網頁登錄和抓資料[在USBWebserver測試驗證過]
wget / PHP使用 curl函式庫 模擬網頁登錄和抓資料[在USBWebserver測試驗證過]
GITHUB:https://github.com/jash-git/wget_curl_login_PHP_getData
login.php
<?php $username = htmlspecialchars($_POST[‘username’]); if($username===’jash’ && $password==’1234′) |
outjson.php
<?php //檢測是否登錄,若沒登錄則轉向登錄介面 |
wget_test.bat
wget –post-data=”username=jash&password=1234″ –save-cookies=cookie.txt –keep-session-cookies http://localhost:8080/cs2php/login.php -O login.html wget –load-cookies=cookie.txt “http://localhost:8080/cs2php/outjson.php” -O outjson.txt |
php_curl_login.php
<?php $ch = curl_init(); |