dqpfl2508589 2013-05-09 10:48
浏览 40
已采纳

使用php在其他网站上提交表单

Im making a dashboard for myself in php to automate tasks that i have to do over several websites, some of the sites have api's which is great, but others dont so i was wandering if theres a way i get my code to submit order forms and other actions on sites, when instructed.

As an example - i would have a list of books (which would be linked to their urls in amazon) in my dashboard, i could then click a check button on the ones i wanted, then click buy in my dashboard. This would then on amazons site, select the books, and go through the check out and order process.

I suppose its not a million miles away from a 'spam' script the sort that submits comments on blogs. As far as automated interactions with other sites.

Im newish to php, and haven't really an idea were to start with somthing like this, could someone point me in the right direction ?

  • 写回答

1条回答 默认 最新

  • drq1257 2013-05-09 10:54
    关注

    The system is simple. Map out all the calls that your browsers do to get to a page (including cookies, headers etc). When you have all of them - automate them!

    The automation tool you're after is a library called cURL. It's PHP, and it allows the script to perform requests to other servers. This will allow you to pretty much do anything you like, and also to parse the replies (through tools like DOMDocument or SimpleHTML).

    Instead of repeating myself, I'll link to another answer where I wrote a complete parser for someone: https://stackoverflow.com/a/16144603/2167834 . This should show you a way to get data and perform requests. From there, it's a simple case of chaining requests together.

    Note, however, that your script is limited by the execution time of PHP (default 30s).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料