Answers
我比较喜欢用php-curl-class这个包
php
use \Curl\Curl; $curl = new Curl(); $curl->get('http://www.example.com/'); $curl = new Curl(); $curl->setBasicAuthentication('username', 'password'); $curl->setUserAgent(''); $curl->setReferrer(''); $curl->setHeader('X-Requested-With', 'XMLHttpRequest'); $curl->setCookie('key', 'value'); $curl->get('http://www.example.com/'); if ($curl->error) { echo 'Error: ' . $curl->errorCode . ': ' . $curl->errorMessage; } else { echo $curl->response; } var_dump($curl->requestHeaders); var_dump($curl->responseHeaders);
傲娇D蕾米酱
answered 9 years, 9 months ago