PHP POST传递参数

180it 2019-11-05 AM 3764℃ 0条

<?php

header("Content-type: text/html; charset=utf-8");
$name = 'wd='.$_GET['name'];
$html = (string)request_by_curl('http://yongjiuzy.net/index.php?m=vod-search',$name);
$a = '/<td class=\".*\"><a href=\"(.*)\" .*>(.*)<font color=\".*\">/';
preg_match_all($a,$html,$m);
foreach ($m[2] as $value) {
    $text[] = $value;
}
foreach ($m[1] as $value) {
    $href[] = $value;
}
 
$all = array('name' =>$text ,'href' =>$href );
$all_json = json_encode($all);
echo $all_json;

function request_by_curl($remote_server, $post_string) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $remote_server);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, "ChinaLBT");
    $data = curl_exec($ch);
    curl_close($ch);     
    return $data;
}

?>

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

PHP POST传递参数