zoukankan      html  css  js  c++  java
  • 简单php post请求

            for ($i = 1000; $i < 11000; $i++) {
                $url = '***********';
                $client = new GuzzleHttpClient();
                $response = $client->request(
                    'POST',
                    $url,
                    [
                        'headers' => ['Content-Type' => 'application/x-www-form-urlencoded'],
                        'form_params' => [
                            'appid' => 'qdcacxpfuvdxsxpuaeuvqadwffrauqww',
                            'v' => '1.0.0.0',
                            'os' => 'android',
                            'terminal' => '2',
                            'channel' => '',
                            'udid' => '10X40VI9PlVlUDTBftGbd9oRF3lIDe7lf'.$i,
                            'timestamp' => '20161230161048',
                            'token' => '',
                            'sign' => '109d3ce559c86e6869fc097b81bd90b3',
                            'page' => '1',
                            'step' => '10',
                            'programType' => 'news',
                            'programId' => 'c6293dbb56fd4223838a3edd0a8815d8'
                        ]
                    ]
                );
    
    
                $a = $response;
            }
    

      

       public function indexAction()
        {
            $url = '*****';
            $client = new GuzzleHttpClient();
    
            $jar = new GuzzleHttpCookieCookieJar();
            $jar->clear();
            foreach ($_COOKIE as $key => $value) {
                $newCookie = GuzzleHttpCookieSetCookie::fromString() ;  //::fromString($key'Name=' . $key . ';' . 'Value=' . $value . ';' . 'Domain=qa-api.dowedo.com.cn');
                $newCookie->setName($key);
                $newCookie->setValue($value);
                $newCookie->setDomain('qa-api.dowedo.com.cn');
                $jar->setCookie($newCookie);
            }
    
            $defaultOptions = ['cookies' => $jar];
            /**
             * Now loop through the cookies adding them to the jar
             */
    
    
            $response = $client->request(
                'GET',
                $url, $defaultOptions
            );
    
            $a = (string)$response->getBody();
            return $response;
        }
    

      

  • 相关阅读:
    html5 历史管理
    html5小知识点
    html5的Form新特性
    html5语义化标签
    Comet反向ajax技术实现客服聊天系统
    Js类的静态方法与实例方法区分以及jQuery如何拓展两种方法
    浏览器中关于事件的那点事儿
    iOS 强制横竖屏方法 -
    编辑readme 文件 -
    iOS- FFmpeg库的编译
  • 原文地址:https://www.cnblogs.com/psy-sdudio/p/8268260.html
Copyright © 2011-2022 走看看