2011-07-28 66 views
1

可能重复:
Is there a PHP equivalent of Perl's WWW::Mechanize?使用php curl来自动化网站。

无论如何,卷曲PHP来做到这一点?

import mechanize 
    br=mechanize.Browser() 
    br.open('https://www.google.com/calendar/exporticalzip') 
    br.select_form(nr=0) 
    br['Email']='[email protected]' 
    br['Passwd']='Password' 
    br.submit() 
    br.retrieve('https://www.google.com/calendar/exporticalzip','exportical.zip') 
+0

机械化和卷曲并非如此相似,事实上他们都可以检索基于HTTP的内容。 – Orbling

+0

[有没有Perl的WWW :: Mechanize的PHP等价物?](http://stackoverflow.com/questions/199045/is-there-a-php-equivalent-of-perls-wwwmechanize)或[Mechanizeize和BeautifulSoup for PHP?](http://stackoverflow.com/questions/1263800/mechanize-and-beautifulsoup-for-php) – Orbling

回答

0

有一个很好的PHP类,模拟网页浏览器很像curl叫Snoopy

它允许很多额外的功能,如从提取的页面中提取链接和提取表单元素,这可能对您的情况非常有用。