背景:PHP利用GET/POST提交方式向第三方传递数据并获取第三方接口返回值
- GET方式
单链接
带参数$url = 'https://tih-api.stb.gov.sg/content/v1/search/all'; $result = file_get_contents($url); dump(json_decode($result,true));
以json格式提交$url = 'https://tih-api.stb.gov.sg/content/v1/search/all'; $params = array( 'dataset' => "attractions", 'language'=> "zh-cn", 'apikey'=> "nHedovedovedoveG", ); $url .= "?".http_build_query($params); $result = file_get_contents($url); dump(json_decode($result,true));
$url = 'https://api-cn.faceplusplus.com/facepp/v3/detect'; $dd = array( 'api_key' => "xxxx