开发者

PHP proxy for cross-domain AJAX scripting

I have set up a simple php proxy

 $proxy = 'tcp://127.0.0.1:8080';

 $context = array(
    'http' => array(
              开发者_开发百科 'proxy' => $proxy,
               'request_fulluri' => True,
    ),
 );

 $context = stream_context_create($context);

 $body = file_get_contents("http://www.php.net", False, $context);
 print $body

I want to be able to make ajax request from one subdomain to another. Unfortunately the code above does not work yet. When I make an request the script loads for a long time without success.

Any ideas?


I'm not sure if you understood AJAX proxy correctly. Check out this article, it's stated there that PHP script itself is a proxy, so there's no need to use tcp proxy via streams.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜