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).

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

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集