【问题标题】:Youtube API PHP problemYoutube API PHP 问题
【发布时间】:2010-02-18 19:03:35
【问题描述】:

我从 zend.com 下载了库 Yotube API PHP(搜索视频)及其示例。 在 Windows(本地主机)上一切正常... 在 debian 服务器上上传,并在请求搜索视频时出现错误:

Invalid response received - Status: 404

来自 videoO-browser.js 的错误代码

/**
 * Sends an AJAX request to the server to retrieve a list of videos or
 * the video player/metadata.  Sends the request to the specified filePath
 * on the same host, passing the specified params, and filling the specified
 * resultDivName with the resutls upon success.
 * @param {String} filePath The path to which the request should be sent
 * @param {String} params The URL encoded POST params
 * @param {String} resultDivName The name of the DIV used to hold the results
 */
ytvbp.sendRequest = function(filePath, params, resultDivName) {
  if (window.XMLHttpRequest) {
    var xmlhr = new XMLHttpRequest();
  } else {
    var xmlhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  }

  xmlhr.open('POST', filePath, true);
  xmlhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

  xmlhr.onreadystatechange = function() {
    var resultDiv = document.getElementById(resultDivName);
    if (xmlhr.readyState == 1) {
      resultDiv.innerHTML = '<b>Loading...</b>'; 
    } else if (xmlhr.readyState == 4 && xmlhr.status == 200) {
      if (xmlhr.responseText) {
        resultDiv.innerHTML = xmlhr.responseText;
      }
    } else if (xmlhr.readyState == 4) {
      alert('Invalid response received - Status: ' + xmlhr.status);
    }
  }
  xmlhr.send(params);
}

英语不好,抱歉

【问题讨论】:

    标签: php zend-framework youtube http-status-code-404 zend-gdata


    【解决方案1】:

    显然,您的请求字符串以某种方式错误传输(错误 404 = 未找到资源)。您想通过使用 echo 进行调试和正确的位置来检查本地副本和服务器副本之间究竟有什么不同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-24
      • 1970-01-01
      • 2016-11-09
      • 2011-03-31
      • 2011-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多