首页 > 代码库 > php curl
php curl
<?php
$uri = "http://113.57.142.227/sipopublicsearch/search/executeGeneralSearch-returnResultOnly.shtml";
// 参数数组
$data = http://www.mamicode.com/array (
‘searchCondition.dbId‘ => ‘VDB‘,
‘searchCondition.searchExp‘ => ‘‘,
‘searchCondition.searchType‘ => ‘Sino_foreign‘,
‘wee.bizlog.modulelevel‘ => ‘0200101‘,
);
$ch = curl_init ();
// print_r($ch);
curl_setopt ( $ch, CURLOPT_URL, $uri );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
#curl_setopt($ch, CURLOPT_HTTPHEADER, false);
curl_setopt ( $ch, CURLOPT_HEADER, 0 ); //doesnot include header in result
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1);//set redirect to return of curl_exec
curl_setopt($ch, CURLOPT_ENCODING, "");
$return = curl_exec ( $ch );
if ($return === false) {
var_dump(curl_error($ch));
}
curl_close ( $ch );
$return = preg_replace(‘/($\s*$)|(^\s*^)/m‘, ‘‘, $return);
#$matches=array();
preg_match("/(申请号)/m", $return, $matches);
foreach($matches as $match) {
print $match;
}
#print_r($return);
php curl