donglu3243 2012-10-25 08:40
浏览 17
已采纳

如何使用iMacros和PHP提取下拉列表的所有COMBO值

I need to extract the pricing data from a form. The form contain several dropdown options. All combo of options must be extracted.

Example of the form dropdown:

size => 1, 2, 3, 4, 5
type => 1, 2, 3, 4
color => 1, 2, 3
units => 1, 2, 3, 4, 5, 6, 7

So this particular product has 420 possible configurations size * type * color * units

How do I write some some sort of loop which will get all possible combinations?

TAG POS=1 TYPE=SELECT FORM=ACTION:/food/getPrice.do ATTR=NAME:size CONTENT=#1

By the way trying to use imacros to select an option by index as shown in the example above does not work. I am forced to select by specifying the value (such as: %1)

I also tried SET !DATASOURCE and imported a CSV file but it didn't loop through as I need it to.

--Just to clarify -- I need this kind of output (doesn't have to be in this order, but MUST output all possible combinations):

size => 1 type => 1 color => 1 units => 1
size => 1 type => 2 color => 1 units => 1
size => 1 type => 2 color => 2 units => 1
size => 1 type => 2 color => 2 units => 2
size => 1 type => 2 color => 2 units => 2
size => 1 type => 3 color => 1 units => 1
   . . .

--Side Note-- If you know of how I can run this imacro from a shared server (or EC2) please advise. Thanks for the help! :)

  • 写回答

1条回答 默认 最新

  • douxu3732 2012-10-25 13:36
    关注

    You're looking for the cartesian product, which is described here in PHP: PHP 2D Array output all combinations

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

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改