http://www.taodaxiang.com/credit/index/init
这个页面需要post查询后。在抓取查询的数据。这个用php怎么写?求代码
回复讨论(解决方案)
建议你参考一下CURL
百度一下有很多
不行。百度的都抓取失败。
没有人吗?
curl 就可以,不过查询到的信息是通过 app_init.js 动态写入页面的
所以你还需抓取 app_init.js 后自行解析
比如取回的页面中有
<td>注册时间:<p id='info_regtime'></p></td><td>实名认证:<p id='info_auth'></p></td>app_init.js 中有
$("#info_regtime").html("<span style='color:green'><b>"+data.regtime+"</b></span>");$("#info_auth").html("<span style='color:"+color+"'><b>"+data.auth+"</b></span>");
curl 这个好像不用你说哟。php抓取三种方式,我都试过了。就是抓取失败。所以才来发帖求助
js?入dom的,需要curl後再分析,再curl?取的。
我试了下只能抓取到一个空页面(就一个[] 内容),应该是做了只能本站点提交表单的限制
<?phpclass mycurl { protected $_useragent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1'; protected $_url; protected $_followlocation; protected $_timeout; protected $_maxRedirects; protected $_cookieFileLocation = './cookie.txt'; protected $_post; protected $_postFields; protected $_referer ="http://www.taodaxiang.com/credit/index/init"; protected $_session; protected $_webpage; protected $_includeHeader; protected $_noBody; protected $_status; protected $_binaryTransfer; public $authentication = 0; public $auth_name = ''; public $auth_pass = ''; public function useAuth($use){ $this->authentication = 0; if($use == true) $this->authentication = 1; } public function setName($name){ $this->auth_name = $name; } public function setPass($pass){ $this->auth_pass = $pass; } public function __construct($url,$followlocation = true,$timeOut = 30,$maxRedirecs = 4,$binaryTransfer = false,$includeHeader = false,$noBody = false) { $this->_url = $url; $this->_followlocation = $followlocation; $this->_timeout = $timeOut; $this->_maxRedirects = $maxRedirecs; $this->_noBody = $noBody; $this->_includeHeader = $includeHeader; $this->_binaryTransfer = $binaryTransfer; $this->_cookieFileLocation = dirname(__FILE__).'/cookie.txt'; } public function setReferer($referer){ $this->_referer = $referer; } public function setCookiFileLocation($path) { $this->_cookieFileLocation = $path; } public function setPost ($postFields) { $this->_post = true; $this->_postFields = $postFields; } public function setUserAgent($userAgent) { $this->_useragent = $userAgent; } public function createCurl($url = 'nul') { if($url != 'nul'){ $this->_url = $url; } $s = curl_init(); curl_setopt($s,CURLOPT_URL,$this->_url); curl_setopt($s,CURLOPT_HTTPHEADER,array('Expect:')); curl_setopt($s,CURLOPT_TIMEOUT,$this->_timeout); curl_setopt($s,CURLOPT_MAXREDIRS,$this->_maxRedirects); curl_setopt($s,CURLOPT_RETURNTRANSFER,true); curl_setopt($s,CURLOPT_FOLLOWLOCATION,$this->_followlocation); curl_setopt($s,CURLOPT_COOKIEJAR,$this->_cookieFileLocation); curl_setopt($s,CURLOPT_COOKIEFILE,$this->_cookieFileLocation); if($this->authentication == 1){ curl_setopt($s, CURLOPT_USERPWD, $this->auth_name.':'.$this->auth_pass); } if($this->_post) { curl_setopt($s,CURLOPT_POST,true); curl_setopt($s,CURLOPT_POSTFIELDS,$this->_postFields); } if($this->_includeHeader) { curl_setopt($s,CURLOPT_HEADER,true); } if($this->_noBody) { curl_setopt($s,CURLOPT_NOBODY,true); } /* if($this->_binary) { curl_setopt($s,CURLOPT_BINARYTRANSFER,true); } */ curl_setopt($s,CURLOPT_USERAGENT,$this->_useragent); curl_setopt($s,CURLOPT_REFERER,$this->_referer); $this->_webpage = curl_exec($s); $this->_status = curl_getinfo($s,CURLINFO_HTTP_CODE); curl_close($s); } public function getHttpStatus() { return $this->_status; } public function __tostring(){ return $this->_webpage; }}$m=new mycurl("http://www.taodaxiang.com/credit/index/get");$m->setReferer("http://www.taodaxiang.com/credit/index/init");$m->setPost(Array("account"=>"cupjava"));$m->createCurl();echo $m;?>
json结果出来解析一下就好了
9楼是神人。万分感谢,可以了

PhpisusedforsendingemailsduetoitsintegrationWithservermailservicesandexternalsmtpproviders, automatingnotificationsandmarketingcampaigns.1) Setupyourphpenvironmentwithawebserverandphp, Memastikan

Cara terbaik untuk menghantar e -mel ialah menggunakan perpustakaan phpmailer. 1) Menggunakan fungsi mel () adalah mudah tetapi tidak boleh dipercayai, yang boleh menyebabkan e -mel memasuki spam atau tidak dapat dihantar. 2) PHPMailer menyediakan kawalan dan kebolehpercayaan yang lebih baik, dan menyokong surat HTML, lampiran dan pengesahan SMTP. 3) Pastikan tetapan SMTP dikonfigurasi dengan betul dan penyulitan (seperti startTLS atau SSL/TLS) digunakan untuk meningkatkan keselamatan. 4) Untuk sejumlah besar e -mel, pertimbangkan untuk menggunakan sistem giliran mel untuk mengoptimumkan prestasi.

CustomheadersandadvancedfeaturesInphpeMailenhanceFunctialityandreliability.1) customHeadersAddmetadataFortrackingandCategorization.2) htmlemailsallowformattingIntivity.3)

Menghantar mel menggunakan PHP dan SMTP boleh dicapai melalui Perpustakaan PHPMailer. 1) Pasang dan konfigurasikan PHPMailer, 2) Tetapkan butiran pelayan SMTP, 3) Tentukan kandungan e -mel, 4) Hantar e -mel dan mengendalikan kesilapan. Gunakan kaedah ini untuk memastikan kebolehpercayaan dan keselamatan e -mel.

Thebestapproachforsendingemailsinphpisusingthephpmaillibraryduetoitsreliability, featureRichness, andeaseofuse.phpmailersupportssmtp, proveddetaileDerrorHandling, membolehkanSendsendingHtmlandPlainteMails, supportsattachments, danStoVeShanCess

Alasan untuk menggunakan suntikan ketergantungan (DI) ialah ia menggalakkan gandingan longgar, kebolehlihatan, dan pemeliharaan kod. 1) Gunakan pembina untuk menyuntik kebergantungan, 2) Elakkan menggunakan pencari perkhidmatan, 3) Gunakan bekas suntikan ketergantungan untuk menguruskan kebergantungan, 4) meningkatkan kesesuaian melalui suntikan suntikan, 5) Elakkan kebergantungan over-suntikan, 6) Pertimbangkan kesan DI terhadap prestasi.

Phpperformancetuningiscrucialbecauseitenhancesspeedandeficiency, whoarevitalforwebapplications.1) cachingwithapcureSdatabaseloadandimprovesresponsetimes.2)

TthebestpracticesforDailssecureeleynpinceDudududude: 1) usingSecureConfigurationsatiationswithsmtpandStartTartTlSencrryption, 2) vactrentatiatingIsTitionputStopReventInJectaCtAtactaSs, 3) engrypTyptingSensensitiVIdAdAlsHAlSiSsSenSsensSl ,SsengsSenSsensSl ,SsengSiSsSSSsSsSsSsSsSsSsSsSsSsSsSsSsSsSsSsSsSsSsSssSsSsSsSsSsSsSsSsSsSsSsSsSsSsSsSSSSsSSSSSSSSSHAsSsSSSSSHAsSsSengs.)


Alat AI Hot

Undresser.AI Undress
Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover
Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool
Gambar buka pakaian secara percuma

Clothoff.io
Penyingkiran pakaian AI

Video Face Swap
Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Artikel Panas

Alat panas

SublimeText3 versi Inggeris
Disyorkan: Versi Win, menyokong gesaan kod!

SublimeText3 Linux versi baharu
SublimeText3 Linux versi terkini

Penyesuai Pelayan SAP NetWeaver untuk Eclipse
Integrasikan Eclipse dengan pelayan aplikasi SAP NetWeaver.

SublimeText3 versi Mac
Perisian penyuntingan kod peringkat Tuhan (SublimeText3)

Pelayar Peperiksaan Selamat
Pelayar Peperiksaan Selamat ialah persekitaran pelayar selamat untuk mengambil peperiksaan dalam talian dengan selamat. Perisian ini menukar mana-mana komputer menjadi stesen kerja yang selamat. Ia mengawal akses kepada mana-mana utiliti dan menghalang pelajar daripada menggunakan sumber yang tidak dibenarkan.
