CURL

<?php

    $url = "https://activity.baidu.com/incentive/box/add";//你要请求的地址

    $header = array(
        'Content-Type:application/x-www-form-urlencoded',
        "Cookie:matrixstyle=0; BAIDUCUID=0a2Qu0iP2u_6uv89_aS2uliFvugSPSfzlavHfgaIv8_b82iuluvtalfr3ulMiHat6WEmA; BAIDULOCNEW=12358088.449501_4143571.101775_100000.00_328_1685843805000_1; fontsize=1.00; WISE_HI_NazcFp_AD9YS2rwuTqawxL-3MEF3VEVFoKew0Zoeo1cRKs-xRvafmIsyzJb2Xc1TD81-jyzVmIOIpfQHvXKuuNw3jlnEpZKSWBWenoRYLecVoiEGY2"
    );


    $post_data = array(
        "productid" => "2",
        "isNewTask" => "1",
        "pt" => "ff21e6e7f0ca7cffc5c7a2b66754b21dac41db21e529a62c625263d7f824d9bb2b4ce71827f66441a0b86deb6fae943eb8a14474b8b3ef6b10612830441a",
        "fv" => "13.30.0.10",
        "cfrom" => "1005640h",
        "from" => "1005640h",
        "ua" => "828_1792_iphone_6.3.0.10_0",
        "st" => "0",
        "branchname" => "baiduboxlite",
        "ds_lv" => "4",
        "ds_stc" => "0.9450",
        "matrixstyle" => "0",
        "network" => "1_0",
        "osbranch" => "i3",
        "osname" => "baiduboxapp",
        "puid" => "_u-g8gPQ2iLISqqqB",
        "service" => "bdbox",
        "zid" => "y8Q5M1EFsGe30M7lYk01_xgUa-XONcgFj5QwMPOlzzfZdV1hwXSch_RIm-puz_xonBk6iD2PTn8gawArXY_VsqA",
        "t" => "1685844155",
        "sign" => "d7e1495ddcf0c6d9a02534227d912efa",
    );
    $postData = http_build_query($post_data);

//    $str = "productid=2&isNewTask=1&pt=ff21e6e7f0ca7cffc5c7a2b66754b21dac41db21e529a62c625263d7f824d9bb2b4ce71827f66441a0b86deb6fae943eb8a14474b8b3ef6b10612830441a&fv=13.30.0.10&cfrom=1005640h&from=1005640h&ua=828_1792_iphone_6.3.0.10_0&st=0&branchname=baiduboxlite&ds_lv=4&ds_stc=0.9450&matrixstyle=0&network=1_0&osbranch=i3&osname=baiduboxapp&puid=_u-g8gPQ2iLISqqqB&service=bdbox&zid=y8Q5M1EFsGe30M7lYk01_xgUa-XONcgFj5QwMPOlzzfZdV1hwXSch_RIm-puz_xonBk6iD2PTn8gawArXY_VsqA&t=1685844155&sign=d7e1495ddcf0c6d9a02534227d912efa";
    $ch = curl_init();//初始化cURL

    curl_setopt($ch, CURLOPT_URL, $url);//抓取指定网页
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//要求结果为字符串并输出到屏幕上
    curl_setopt($ch, CURLOPT_POST, 1);//Post请求方式
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);//Post变量
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //模拟的header头

    $output = curl_exec($ch);//执行并获得HTML内容
    curl_close($ch);//释放cURL句柄
    print_r($output);die;
posted @ 2023-06-04 11:12  linsonga  阅读(119)  评论(0编辑  收藏  举报