【问题标题】:Getting Feedburner Subscriber With CURL使用 CURL 获取 Feedburner 订阅者
【发布时间】:2025-12-18 20:55:02
【问题描述】:

我正在使用 FeedBurner Awareness API。像这样的 XML 数据:

<rsp stat="ok">
−
<!--
This information is part of the FeedBurner Awareness API. If you want to hide this information, you may do so via your FeedBurner Account.
-->
−
<feed id="9n66llmt1frfir51p0oa367ru4" uri="teknoblogo">
<entry date="2011-01-15" circulation="11" hits="18" reach="0"/>
</feed>
</rsp>

我要获取流通量数据 (11) 。我正在使用此代码:

$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=teknoblogo";

//Initialize the Curl session
$ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);

//Execute the fetch
$data = curl_exec($ch);

//Close the connection
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
echo $fb;
echo "OK";

但是,返回的数据是空白的。没有任何错误。只返回 OK 。我该如何解决这个问题?

编辑:回显 $data;也返回空白。

【问题讨论】:

    标签: php curl subscription feedburner


    【解决方案1】:

    您是否尝试过使用http 而不是https

    对于这种情况,我认为使用http不会有任何问题。

    一些网络托管服务提供商和一些服务器禁用了 cURL 的 SSL。

    您可能想look at this question 了解如何使用 cURL + SSL。

    【讨论】:

    • 谢谢。但还是同样的问题。
    • 实际上,它对我有用 (https)。您可能需要检查服务器是否可以访问资源。
    • 你可以试试print_rcurl_getinfo 吗?
    • 添加了这段代码 print_r(curl_getinfo($ch)); ,没有返回。但是代码开始工作。它返回 11 。我正在删除 print_r(curl_getinfo($ch)); 代码但仍在工作:D 我不明白。我的问题现在解决了,但我不明白是怎么解决的。