模拟POST请求

html=;foreach(html = ''; foreach (html=′′;foreach(native as $key => $val){
KaTeX parse error: Expected '}', got 'EOF' at end of input: …"<input name='{key}’ type=‘text’ value=’{$val}’ />";
}

    echo "<form style='display:none;' id='form1' name='form1' method='post' action='{$tjurl}'>{$html}</form>
        <script type='text/javascript'>function load_submit(){document.form1.submit()}load_submit();</script>";
    exit();

KaTeX parse error: Expected '}', got 'EOF' at end of input: …bmit' action='{this->gateway}’ method=‘post’>";
foreach ($this->config as $key => $value) {
$value = str_replace("’", ‘’’, $value);
KaTeX parse error: Expected '}', got 'EOF' at end of input: …hidden' name='{key}’ value=’{$value}’/>";
}
$html .= “”;
return $html . “”;

public function post_curl($url, $post){
ch=curlinit(ch = curl_init(ch=curli​nit(url);
timeout=6000;curlsetopt(timeout = 6000; curl_setopt(timeout=6000;curls​etopt(ch, CURLOPT_POST, 1);
curl_setopt(ch,CURLOPTHEADER,0);curlsetopt(ch, CURLOPT_HEADER, 0); curl_setopt(ch,CURLOPTH​EADER,0);curls​etopt(ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt(ch,CURLOPTRETURNTRANSFER,1);curlsetopt(ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt(ch,CURLOPTR​ETURNTRANSFER,1);curls​etopt(ch, CURLOPT_FORBID_REUSE, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, timeout);//curlsetopt(timeout); //本地测试 不验证证书 curl_setopt(timeout);//本地测试不验证证书curls​etopt(ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证证书

    $data_string = json_encode($post);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Content-Type: application/json; charset=utf-8",
            "Content-Length: " . strlen($data_string))
    );
    $ret = curl_exec($ch);
    curl_close($ch);
    return $ret;
}
上一篇:libcurl第三课 HTTP获取天气信息


下一篇:PHP 获取银行卡所属信息