使用PHP CURL的报废页面可使用AJAX

时间:2019-03-17 15:09:11

标签: php web curl web-scraping

我有一个网站要剪贴http://cbseaff.nic.in/cbse_aff/schdir_Report/userview.aspx,我想在其中列出获取Region的{​​{1}}中学校的列表。

为此,我编写了以下Delhi代码。

PHP

现在,如果您注意到在<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"http://cbseaff.nic.in/cbse_aff/schdir_Report/userview.aspx"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=7EFDKXQDH6F8kPRWFB%2BR0YcXkLHELxo%2FesOxiKh8N85Vwg3R6ew5gWqRCK5OknAmdVTw7qTshIZQy%2FjnYwQYKn9uNoAV0xrd6WZbIsMkLug0UfjrR2S%2F5WjZH5rdHB6sMn%2FTGPy3o1gN%2FNMaFBaqBDiUm6iQwmbEiRNjBSMhgEnzjKUj9HrWO7ke%2FKlaU7x93IUCyZ5E%2BindJZLQ1sqGA7Ccngct6YaoBZoKuNpdK%2BEfjS5U3O9avg4Xdtez7dUdMrGNkdmplN43iBBbEExUGe4mvnY7pK4Li5XdPiwHahR1XrladUUZTxg5lb4eAPwnMGfDqUmx9CYogRUUlNpDK8%2FgWG74lEPKDEVJqzQxstuI5lX1VWgvKcArICfsVmknUMidQOVPJYUZ1zL8OdfAh0ma7Qi%2FQqUNyMuqznW8ynnLsZfb9Fc0bC7Bsb8vV4%2Bz6ez7O2OifBbPzpPMsUzR3p3EHN0ak3DqKyrqTqXN%2Bc%2F6Xs7OdpS4N%2FljWCuKFMUBPqiJ5h%2BrlILwzf3%2Bg1lvTBPxhG%2BV2FZNBFDbFWYuh6EsKQDkbF7niFf94NQI93jOTa7NRMmdv6Tpro%2F%2BOnmRnuX%2B9QHFVZCHggN656nEWvdJUxJAlulnTJvnH9WzGtsz6PBz1wHsMWkNoqa%2BkWee5X%2Bquc0SBymz%2FH3T7t%2BVFWBT5cMdVTo3oivhB0WabXnwd7tVsJGBcoaahKocJQGXy5sLnykd37glb5SJH2jg41WbBUVJQ260hbr0JYBXa2xxTYr9UxyAycVVY2ZZ6zuf%2BiVLGK95i1naHWK9ot3Y%2BYd%2BWtK%2Fe3eB0A%2Bt8cvXhppSo6ZDWfpczicYM18%2FrzWpYVP4KPUI5Zcjg4ISfEqkaqkMHLhkwtvdeA1RZHLJxPs4YGM%2Bs6omorUSEO5wJ2Q4z%2FFNQsWy9YHeLY5nwZpKEBdlsq0kWOzshZhuVRZaD%2BtNrbaefvqgVoPhpT15ufmEF0zf0F6rNuXXUUslVHxadZYjUSlIGpv2rRSZ3ph%2BR3vu&__VIEWSTATEGENERATOR=AC872EDD&__VIEWSTATEENCRYPTED=&ctl00%24ContentPlaceHolder1%24optlist=Region+Wise&ctl00%24ContentPlaceHolder1%24ddlitem=D&ctl00%24ContentPlaceHolder1%24optlistChoiceRegion=List+of+All+Schools&ctl00%24ContentPlaceHolder1%24search=Search"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $server_output = curl_exec($ch); echo $server_output; curl_close ($ch);的末尾,我已经通过了POSTFIELDS,这是前25个结果。

现在,为了从26-50继续前进,我将POST_FIELD更改为Search=Search

这是我完整的POSTFIELD数据Button1=Next+%3E%3E

您会在底部看到__EVENTTARGET=&__EVENTARGUMENT=&__LASTFOCUS=&__VIEWSTATE=uC0unVTBdxINsKOm4p%2FNuz8Nt9%2BuAi0PZghN07rhWSr02CoT9pIfUfWmElUwfEtDICubqyL4rKvW7hS4FgNLYtt3UKAA3mAFPcjbahPB7FjA6Lc2omVofLdunYRoE09Yb8v%2FRlfC6Emdemt9Xa6fi1IfMIZao57WkS0sS2wxHAyJj7RnZkki9rzu%2FbRdHVQ0qWE9y%2BMvc%2FCqha8BrRCSKzowZe6zWiT1R1K0XKp19u10CNR6mmrdQcZgrVopc8VKFg0J%2FfQO9T2%2FZDRZZqt%2FF9%2B6D7q0ld%2B8EEajKS9uJnGMN4R9%2FKjjUL3sVZv6cce8Tjj%2BPO4VjR8PwYXvMxApV5deL9LPoSDCJT%2FcfcWSTvCa7gEk%2FNfA10mldTz6bDjzdWa9x7LotUJgeaIaKbt4y4sPbSI1hJd5nGd%2FHfxoK24ROAY9ENAS7dLhmOfsDYBWbPMzyXGWcEzpPOJyeSqftxNF6LoYVCa81QW7DFpSBFB1BubFaMOJkKOt8b25wr7oi7FwsHWeLbE1UPY6A8DQDUzXNp39CtXmv5DWrpFsKfOAvtjiVQodj9Y9ViSyRQa3H3FyUuFNN%2BQvYwMYvkocwFWXoffTBiGi7AqwuAXaAiMLM6Of%2Fdbrd1rorQFiI8L6ifC%2Bbj8lWwSp6%2F7wSJmLPTOmBK%2B2Fn0He3viuvETSGl6XoI0s%2FKmLKwB6Gg%2B%2BRUGZCon8bLRurz%2BRgHskQeG5sdR1v1aczpvOBpY0ENL3O0svM35IhFqs2T76Eoj9Zd6%2BJBPFMNKWLF4xqAvahKO1fLOiwYhFuKwSbzzE592y0GWMHAgNaxY6ju1ZELsMETpUTBeNdtGXkJtC%2F4XbxUoLumdnLG5CW%2BPBTPaLi55i3N8eSHek3OpNDcqD%2BvmTU7DTfFp4NmHqScd2ZYbiBXNYe8fhOxxxzLSBvg%2BKK%2FdCTiphejVO6MKvOoHgehyS9ZP7KLbVivAIe9hPcguD18gN7OPrepOGGcRvUMXJ%2BMCmQNCJcYCclY%2BcLLXTLYpkY20zUmAnBIxl4p1z4v9hCrYSu6MYk%2BxsKtJ7M7GhRCA7%2FZ8C9NxlfS4BPS1MAM1oVkjVQ9xE4qE23%2Bc4WK%2B9DMTjc4PgFjysJtrsjXuyF9r%2Bx8OAynJ9Bu6yKhCO%2BTlfSmi&__VIEWSTATEGENERATOR=AC872EDD&__VIEWSTATEENCRYPTED=&ctl00%24ContentPlaceHolder1%24optlist=Region+Wise&ctl00%24ContentPlaceHolder1%24ddlitem=D&ctl00%24ContentPlaceHolder1%24optlistChoiceRegion=List+of+All+Schools&ctl00%24ContentPlaceHolder1%24Button1=Next+%3E%3E

现在的问题是我该如何前进。由于这里没有Button1=Next

我也尝试将其放入循环中,但仍然会继续返回前25个结果。

因此,对此提出任何想法。

0 个答案:

没有答案