apache - PHP Message: failed to open stream: HTTP request failed -


i using php script proxy. same script on serer works no problem, on server b not work , receive these errors:

failed open stream: http request failed! http/1.1 401 unauthorized 

and

 cannot modify header information - headers sent 

on server b allow_url_fopen = on

is setup

any idea wrong?

thanks

<?php /*  * in javascript call `encodeuricomponent`  * $.get('proxy.php?proxy_url='+encodeuricomponent('http://google.com?param=1&param2=2'))  */ $url = rawurldecode($_get['proxy_url']); $cb = ! empty($_get['callback']) ? $_get['callback'] : null;  if(preg_match('#ccc\.aaa\.com/bbb/#', $url)){     $url = preg_replace('#http\://xxx\.xxx\.com/xxx/#', '', $url); }  if(! preg_match('#^https?:#', $url)){     $url = preg_replace('#^[\.\/]+#', '', $url);      if(!file_exists($url)){         echo 'file not found';         die(0);     } }  if(preg_match('#\.xml$#', $url)){     header('content-type: text/xml'); }  $file = file_get_contents($url);  if($cb){     header('content-type: application/javascript');     echo $cb.'('.$file.');';  }else{     echo $file; } 


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -