首页 > 代码库 > CURL POST json字符串

CURL POST json字符串


<?php

    $szJson ="json字符串";
    $fpHttp = curl_init("url");
    curl_setopt($fpHttp, CURLOPT_POST, 1);
    curl_setopt($fpHttp, CURLOPT_HTTPHEADER, array("Content-Type:application/json"));
    curl_setopt($fpHttp, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($fpHttp, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($fpHttp, CURLOPT_POSTFIELDS, $szJson);
    curl_setopt($fpHttp, CURLOPT_RETURNTRANSFER, 1);
    $jsonResult = curl_exec($fpHttp);
    curl_close($fpHttp);
    echo $jsonResult;
?>

CURL POST json字符串