[{"data":1,"prerenderedAt":248},["ShallowReactive",2],{"blog:\u002Fblog\u002F2015\u002F08\u002F29\u002Fphp-vote\u002F":3},{"id":4,"title":5,"body":6,"categories":233,"comments":235,"date":236,"description":237,"draft":238,"extension":239,"legacySlug":240,"meta":241,"navigation":235,"path":242,"seo":243,"stem":244,"tags":245,"updated":246,"__hash__":247},"blog\u002Fblog\u002F2015\u002F08\u002F29\u002Fphp-vote.md","php投票小程序",{"type":7,"value":8,"toc":231},"minimark",[9,13,227],[10,11,12],"p",{},"之前帮朋友写的一个投票小程序。比较简单，大家慎用。很多投票系统会有针对IP的限制，下面的**proxy是我在网上搜的免费的IP代理。**url为投票的地址。data是需要发送的数据，这些可以根据具体情况更改。",[14,15,20],"pre",{"className":16,"code":17,"language":18,"meta":19,"style":19},"language-php shiki shiki-themes github-light github-dark","\u003C?php\nset_time_limit(0);\u002F\u002F防止超时\nfunction toupiao($i)\n{\n    $proxy = array('182.48.116.51:8080','110.177.63.191:9999','221.10.40.238:80','221.10.40.236:83','221.10.40.237:80','221.10.102.199:82','42.121.0.247:9999','42.121.28.111:3128','117.135.194.139:80','119.147.91.21:80','58.247.109.243:80','118.233.36.246:8585');\n    $url = \"http:\u002F\u002Fwww.example.com\u002Ftea\u002Flove.php\";\n    $ch = curl_init();\n    $data = array (\n        'id' => '13'\n    );\n    \u002F\u002F设置来源地址，如果不设置，论坛服务器有可能有验证不允许回复\n    curl_setopt($ch,CURLOPT_REFERER,\"http:\u002F\u002Fwww.example.com\u002Ftea\u002Findex.php?m=content&amp;c=index&amp;a=lists&amp;catid=10\");\n    \u002F\u002F能保存cookie\n    curl_setopt($ch,CURLOPT_COOKIESESSION,true);\n    curl_setopt($ch,CURLOPT_USERAGENT,\"Mozilla\u002F4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\");\n    curl_setopt($ch, CURLOPT_PROXY, $proxy[$i]);\n    curl_setopt($ch, CURLOPT_POST, 1);\n    curl_setopt($ch, CURLOPT_HEADER, 0);\n    curl_setopt($ch, CURLOPT_URL,$url);\n    \u002F\u002F为了支持cookie\n    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n    $result = curl_exec($ch);\n    if(curl_errno($ch))\n    {\n        echo 'Curl error: ' . curl_error($ch);\n    }\n}\nfor($i=0;$i=11;$i++)\n{\n    echo \"begin 第\".$i.\"次投票\";\n    toupiao($i);\n    echo 'end';\n    echo \"\u003Cbr\u002F>\";\n}\n","php","",[21,22,23,31,37,43,49,55,61,67,73,79,85,91,97,103,109,115,121,127,133,139,145,151,157,163,169,175,181,187,193,198,204,210,216,222],"code",{"__ignoreMap":19},[24,25,28],"span",{"class":26,"line":27},"line",1,[24,29,30],{},"\u003C?php\n",[24,32,34],{"class":26,"line":33},2,[24,35,36],{},"set_time_limit(0);\u002F\u002F防止超时\n",[24,38,40],{"class":26,"line":39},3,[24,41,42],{},"function toupiao($i)\n",[24,44,46],{"class":26,"line":45},4,[24,47,48],{},"{\n",[24,50,52],{"class":26,"line":51},5,[24,53,54],{},"    $proxy = array('182.48.116.51:8080','110.177.63.191:9999','221.10.40.238:80','221.10.40.236:83','221.10.40.237:80','221.10.102.199:82','42.121.0.247:9999','42.121.28.111:3128','117.135.194.139:80','119.147.91.21:80','58.247.109.243:80','118.233.36.246:8585');\n",[24,56,58],{"class":26,"line":57},6,[24,59,60],{},"    $url = \"http:\u002F\u002Fwww.example.com\u002Ftea\u002Flove.php\";\n",[24,62,64],{"class":26,"line":63},7,[24,65,66],{},"    $ch = curl_init();\n",[24,68,70],{"class":26,"line":69},8,[24,71,72],{},"    $data = array (\n",[24,74,76],{"class":26,"line":75},9,[24,77,78],{},"        'id' => '13'\n",[24,80,82],{"class":26,"line":81},10,[24,83,84],{},"    );\n",[24,86,88],{"class":26,"line":87},11,[24,89,90],{},"    \u002F\u002F设置来源地址，如果不设置，论坛服务器有可能有验证不允许回复\n",[24,92,94],{"class":26,"line":93},12,[24,95,96],{},"    curl_setopt($ch,CURLOPT_REFERER,\"http:\u002F\u002Fwww.example.com\u002Ftea\u002Findex.php?m=content&amp;c=index&amp;a=lists&amp;catid=10\");\n",[24,98,100],{"class":26,"line":99},13,[24,101,102],{},"    \u002F\u002F能保存cookie\n",[24,104,106],{"class":26,"line":105},14,[24,107,108],{},"    curl_setopt($ch,CURLOPT_COOKIESESSION,true);\n",[24,110,112],{"class":26,"line":111},15,[24,113,114],{},"    curl_setopt($ch,CURLOPT_USERAGENT,\"Mozilla\u002F4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)\");\n",[24,116,118],{"class":26,"line":117},16,[24,119,120],{},"    curl_setopt($ch, CURLOPT_PROXY, $proxy[$i]);\n",[24,122,124],{"class":26,"line":123},17,[24,125,126],{},"    curl_setopt($ch, CURLOPT_POST, 1);\n",[24,128,130],{"class":26,"line":129},18,[24,131,132],{},"    curl_setopt($ch, CURLOPT_HEADER, 0);\n",[24,134,136],{"class":26,"line":135},19,[24,137,138],{},"    curl_setopt($ch, CURLOPT_URL,$url);\n",[24,140,142],{"class":26,"line":141},20,[24,143,144],{},"    \u002F\u002F为了支持cookie\n",[24,146,148],{"class":26,"line":147},21,[24,149,150],{},"    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n",[24,152,154],{"class":26,"line":153},22,[24,155,156],{},"    $result = curl_exec($ch);\n",[24,158,160],{"class":26,"line":159},23,[24,161,162],{},"    if(curl_errno($ch))\n",[24,164,166],{"class":26,"line":165},24,[24,167,168],{},"    {\n",[24,170,172],{"class":26,"line":171},25,[24,173,174],{},"        echo 'Curl error: ' . curl_error($ch);\n",[24,176,178],{"class":26,"line":177},26,[24,179,180],{},"    }\n",[24,182,184],{"class":26,"line":183},27,[24,185,186],{},"}\n",[24,188,190],{"class":26,"line":189},28,[24,191,192],{},"for($i=0;$i=11;$i++)\n",[24,194,196],{"class":26,"line":195},29,[24,197,48],{},[24,199,201],{"class":26,"line":200},30,[24,202,203],{},"    echo \"begin 第\".$i.\"次投票\";\n",[24,205,207],{"class":26,"line":206},31,[24,208,209],{},"    toupiao($i);\n",[24,211,213],{"class":26,"line":212},32,[24,214,215],{},"    echo 'end';\n",[24,217,219],{"class":26,"line":218},33,[24,220,221],{},"    echo \"\u003Cbr\u002F>\";\n",[24,223,225],{"class":26,"line":224},34,[24,226,186],{},[228,229,230],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":19,"searchDepth":33,"depth":33,"links":232},[],[234],"PHP",true,"2015-08-29 11:15:00","之前帮朋友写的一个投票小程序。比较简单，大家慎用。很多投票系统会有针对IP的限制，下面的proxy是我在网上搜的免费的IP代理。url为投票的地址。data是需要发送的数据，这些可以根据具体情况更改。",false,"md","php-vote",{},"\u002Fblog\u002F2015\u002F08\u002F29\u002Fphp-vote",{"title":5,"description":237},"blog\u002F2015\u002F08\u002F29\u002Fphp-vote",[234],null,"A1Vl3wepsnWhaHG9YK4heocNGnOknXS0t_2iTxre1Co",1783807996125]