<?php
//进行参数传递接收(get请求方式)
//$debug = (isset($argv[1])&&$argv[1]=='debug')?true:false;
$http = "http://www.baidu.com?&id_no=71a6200aba5c2a83455f10d2d00315be";
$wenshu_json = file_get_contents($http);
$wenshu = json_decode($wenshu_json,true);
$wenshu = $wenshu[0];
$case_num = $wenshu['case_num'];
$id_no = $wenshu['id_no'];
$doc_id = $wenshu['doc_id' ];
$case_type = $wenshu['case_type'];
$anyou_code = $wenshu['anyou_code'];
$anyou_name = $wenshu['anyou_name'];
$fayuan_name = $wenshu['fayuan_name'];
$origin_content = $wenshu['origin_content'];
$fayuan_renwei = $wenshu['fayuan_renwei'];
$doc_type = $wenshu['doc_type'];
$judge_level = $wenshu['judge_level'];
(post请求方式)
$data=array(
'case_type' => "民事",
'judge_level' => $judge_level,
'doc_type' => "判决",
'content' =>$origin_content
);
$url = "http://localhost:3000/looklaw";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$ret = curl_exec($ch);
$html = json_decode($ret, true);
var_dump($html);exit;
php curl网络爬虫简单实例代码
最新推荐文章于 2024-06-26 15:22:47 发布