0

私の Web ホスティング会社は、最近 Apache 2.2.22 と PHP 5.3.13 にアップグレードしたため、スクリプトの一部が正しく機能しなくなりました。Web ページはラジオ ストリーマーであり、テキスト ファイルからトラック情報を更新する部分がまったく表示されません。ストリーマーは正常に動作しており、他のサードパーティ ウィジェットも同様です。

アルバム カバーを表示するスクリプトの一部を次に示します。

updateNowPlayingInfo = function() {
var d = new Date();
$.ajax( '/php_proxy_simple.php?url=playingnow.txt&_=' + d.getTime(), { 
    complete: function( jqXHR, textStatus) { console.log( 'RMX Player XHR completed: ' +textStatus ); },
    error: function( jqXHR, textStatus, errorThrown) { console.log( 'RMX Player XHR error:' + textStatus + ':' + errorThrown ); },
    xhr:  (window.ActiveXObject) ?
    function() {
            try {
                return new window.ActiveXObject("Microsoft.XMLHTTP");
            } catch(e) {}
        } :
        function() {
            return new window.XMLHttpRequest();
        }, 
    cache: true,
    type: 'GET',
    crossDomain: true,
    dataType: 'text',
    global: false, // @note was using false
    ifModified: true,
    success: function( data, textStatus, jqXHR ) {

        //alert( playingData );
        playingData =  data.split("\n");

        if ( playingData[2] && ! playingData[2].match( /no-image-no-ciu/ ) ) {
            //playingData[2] =  playingData[2].replace( 'SS110', 'AA280' ); // swap small image for medium
            //console.log( playingData[2] );
            playingData[2] =  playingData[2].replace( '_SL160_', '_SX200_' ); // swap small image for large
            $( "#nowplaying_album_cover img" ).attr( "src" ,  playingData[2] );
            $( "#nowplaying_album_cover").show();
            }
         else $( "#nowplaying_album_cover").attr("src" , playingData[2] );
         $( "#nowplaying_album_cover").show();
        },
    failure: function() { alert('failed to get play data') ; }
} );

そしてphpコード:

    <?php
// PHP Proxy example for Yahoo! Web services. 
// Responds to both HTTP GET and POST requests

// Allowed hostname
define ('HOSTNAME', 'http://www.mysite.co/');

// Get the REST call path from the AJAX application
// Is it a POST or a GET?
ini_set( 'error_reporting', 0);
$path = ($_POST['url']) ? $_POST['url'] : $_GET['url'];
$url = HOSTNAME.$path.'?timestamp=' . time();

// Open the Curl session
$session = curl_init($url);

// If it's a POST, put the POST data in the body
if ($_POST['url']) {
    $postvars = '';
    while ($element = current($_POST)) {
        $postvars .= urlencode(key($_POST)).'='.urlencode($element).'&';
        next($_POST);
    }
    curl_setopt ($session, CURLOPT_POST, true);
    curl_setopt ($session, CURLOPT_POSTFIELDS, $postvars);
}

// Don't return HTTP headers. Do return the contents of the call
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

// Make the call
$response = curl_exec($session);

// possibly include expires header to bust aggresive caching  -expires=>’+1s’
header('Content-Type: text/html;charset=utf-8');

echo $response;
curl_close($session);

?>

生のログファイルからこれを取得しました:

"GET /playingnow.txt HTTP/1.1" 304

それが関連しているかどうかはわかりません。どんな助けでも大歓迎です。ありがとう

4

1 に答える 1

1

修正しました。PHPファイルのファイル権限は0644である必要がありました。ありがとうございます。

于 2012-07-05T17:57:36.983 に答える