久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

PHP &Facebook: facebook-debug a URL using CURL and Fa

PHP amp; Facebook: facebook-debug a URL using CURL and Facebook debugger(PHP amp;Facebook: facebook-debug a URL using CURL and Facebook debugger)
本文介紹了PHP &Facebook: facebook-debug a URL using CURL and Facebook debugger的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

事實:我運行一個簡單的網站,其中包含文章、通過抓取第三方網站/博客等動態獲取的文章(新文章每半小時左右到達我的網站)、文章我想在我的 facebook 頁面上發帖.每篇文章通常包括一張圖片、一個標題和一些文字.

Facts: I run a simple website that contains articles, articles dynamically acquired by scraping third-party websites/blogs etc (new articles arrive to my website every half an hour or so), articles which I wish to post on my facebook page. Each article typically includes an image, a title and some text.

問題:我在 Facebook 上發布的大部分(幾乎所有)文章都沒有正確發布 - 缺少圖片.

Problem: Most (almost all) of the articles that I post on Facebook are not posted correctly - their images are missing.

低效解決方案:使用 Facebook 的調試器(這個)我向它提交了一篇文章的 URL(來自我網站的 URL,而不是原始來源的 URL),然后 Facebook 掃描/抓取 URL 并正確提取所需的信息(圖像、標題、文本等).執行此操作后,文章可以正確發布到 Facebook 上 - 不會丟失圖片或任何內容.

Inefficient Solution: Using Facebook's debugger (this one) I submit an article's URL to it (URL from my website, not the original source's URL) and Facebook then scans/scrapes the URL and correctly extracts the needed information (image, title, text etc). After this action, the article can be posted on Facebook correctly - no missing images or anything.

目標:我所追求的是一種創建過程的方法,該過程將向 Facebook 的調試器提交 URL,從而迫使 Facebook 掃描/抓取 URL,以便隨后可以正確發布.我相信我需要做的是創建一個包含 URL 的 HTML POST 請求并將其提交給 Facebook 的調試器.這是正確的方法嗎?如果是,因為我以前沒有使用 CURL 的經驗,那么在 PHP 中使用 CURL 的正確方法是什么?

Goal: What I am after is a way to create a process which will submit a URL to Facebook's debugger, thus forcing Facebook to scan/scrape the URL so that it can then be posted correctly. I believe that what I need to do is to create an HTML POST request containing the URL and submit it to Facebook's debugger. Is this the correct way to go? And if yes, as I have no previous experience with CURL, what is the correct way to do it using CURL in PHP?

旁注:作為旁注,我應該提到我的文章使用的是短 URL,盡管我認為這不是問題的原因,因為即使在我使用規范的 URL.

Side Notes: As a side note, I should mention that I am using short URLs for my articles, although I do not think that this is the cause of the problem because the problem persists even when I use the canonical URLs.

此外,Open Graph 元標記設置正確(og:image、og:description 等).

Also, the Open Graph meta tags are correctly set (og:image, og:description, etc).

推薦答案

您可以使用帶有 PHP-cURL 的 Facebook 圖形 API 調試圖形對象,方法是執行 POST

You can debug a graph object using Facebook graph API with PHP-cURL, by doing a POST to

https://graph.facebook.com/v1.0/?id={Object_URL}&scrape=1

為了更簡單,我們可以將調試器包裝在一個函數中:

to make thing easier, we can wrap our debugger within a function:

function facebookDebugger($url) {

        $ch = curl_init();
              curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/v1.0/?id='. urlencode($url). '&scrape=1');
              curl_setopt($ch, CURLOPT_POST, 1);
              curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
              curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        $r = curl_exec($ch);
        return $r;

}

雖然這會更新 &為傳遞的 URL 清除 Facebook 緩存,打印出每個鍵有點困難它的內容并同時避免錯誤,但是我建議使用 var_dump()print_r() 或 PHP-ref

though this will update & clear Facebook cache for the passed URL, it's a bit hard to print out each key & its content and avoid errors in the same time, however I recommended using var_dump() or print_r() OR PHP-ref

使用 PHP-ref

r( facebookDebugger('http://retrogramexplore.tumblr.com/') );

這篇關于PHP &Facebook: facebook-debug a URL using CURL and Facebook debugger的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 免费国产精品久久久久久 | 中文字幕在线播放第一页 | 欧美乱操 | 黄色片视频免费 | 99re在线 | 在线高清免费观看视频 | 91成人在线视频 | 日日摸日日碰夜夜爽亚洲精品蜜乳 | 欧美日韩一区二区在线 | 精品久久久久久 | 中文字幕在线不卡 | 人人做人人澡人人爽欧美 | 九九热视频这里只有精品 | 亚洲精品日本 | 成人片免费看 | 久久精品国产免费高清 | 精品一二区 | 亚洲综合色自拍一区 | 欧美日韩在线一区二区 | 久久综合狠狠综合久久综合88 | 99亚洲精品 | 久久久久久久一区二区三区 | 日韩午夜精品 | 国产精品毛片无码 | 日韩看片 | 在线中文视频 | 欧美二区在线 | 欧美精品99 | 麻豆va| h片在线免费看 | 欧美不卡一区 | 久久久久久国产一区二区三区 | 超碰在线播| 国产精品一区二区不卡 | 一级黄色网页 | 我要看黄色录像一级片 | 久久久2o19精品 | 免费午夜视频在线观看 | 国产精品乱码一区二区三区 | 国产美女特级嫩嫩嫩bbb片 | 五月激情久久 |