码迷,mamicode.com
首页 > Web开发 > 详细

php curl

时间:2014-10-29 19:31:41      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:电动

<?php
$uri = "http://113.57.142.227/sipopublicsearch/search/executeGeneralSearch-returnResultOnly.shtml";
// 参数数组
$data = 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

标签:电动

原文地址:http://qihua.blog.51cto.com/6365095/1569361

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!