首页 > 技术文章 > php代理

xzqyun 2018-10-08 15:16 原文

有些网上接口请求需要用代理

 

php代码

<?php
header('Access-Control-Allow-Origin:*');
$url=$_POST['urlString'];
$res = file_get_contents($url);
echo $res;
?>

 

地址:     http://xzqyun.top/interface/searchmusicheader.php

 

示例代码 

            $.post(
                "http://xzqyun.top/interface/searchmusicheader.php",
                {
                    urlString:'网址'
                },
                function(result){
                    console.log(result);
                }
            );

 

推荐阅读