Facebook Oembed Response Not returning JsonHTTP POST in .NET doesn't work.Net C# : Read attachment from HttpWebResponseFacebook Callback appends '#_=_' to Return URLhow to convert string data to html in richtextboxHow does Facebook disable the browser's integrated Developer Tools?Getting bad request (400) on solrC# Json Deserialize exception (“Error converting value ”id“ to type 'Eng_Tab.JsonData'. Path '[0]', line 1, position 5.”)Facebook OAuth “The domain of this URL isn't included in the app's domain”How to use oembed FacebookFacebook's oEmbed endpoint syntax error as Invalid or unexpected token
Not been paid even after reminding the Treasurer; what should I do?
How to check a file was encrypted (really & correctly)
Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?
How to call made-up data?
Make a living as a math programming freelancer?
If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?
What is the probability of a biased coin coming up heads given that a liar is claiming that the coin came up heads?
Is it double speak?
Why did the US Airways Flight 1549 passengers stay on the wings?
Our group keeps dying during the Lost Mine of Phandelver campaign. What are we doing wrong?
I was contacted by a private bank overseas to get my inheritance
Does the length of a password for Wi-Fi affect speed?
Whats the difference between <processors> and <pipelines> in Sitecore configuration?
Launch capabilities of GSLV Mark III
If the interviewer says "We have other interviews to conduct and then back to you in few days", is it a bad sign to not get the job?
Tile the chessboard with four-colored triominoes
Why should I "believe in" weak solutions to PDEs?
…down the primrose path
Why does putting a dot after the URL remove login information?
How and where to get you research work assessed for PhD?
Why private jets such as GulfStream ones fly higher than other civil jets?
A verb for when some rights are not violated?
Did silent film actors actually say their lines or did they simply improvise “dialogue” while being filmed?
Best way to explain to my boss that I cannot attend a team summit because it is on Rosh Hashana or any other Jewish Holiday
Facebook Oembed Response Not returning Json
HTTP POST in .NET doesn't work.Net C# : Read attachment from HttpWebResponseFacebook Callback appends '#_=_' to Return URLhow to convert string data to html in richtextboxHow does Facebook disable the browser's integrated Developer Tools?Getting bad request (400) on solrC# Json Deserialize exception (“Error converting value ”id“ to type 'Eng_Tab.JsonData'. Path '[0]', line 1, position 5.”)Facebook OAuth “The domain of this URL isn't included in the app's domain”How to use oembed FacebookFacebook's oEmbed endpoint syntax error as Invalid or unexpected token
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to make a Get request to Facebook's Oembed endpoint from server side. When I just go to the URL in my browser it works (click this link: https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F)
However, when making the call from the server side, response isn't a json object.
static void Main(string[] args)
string uri2 = "https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F";
CreateLinkRequest call2 = new CreateLinkRequest();
call2 = Get<CreateLinkRequest>(uri2);
Console.ReadLine();
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
public class CreateLinkRequest
public string provider_name get; set;
public string author_name get; set;
public string width get; set;
public string author_url get; set;
public string title get; set;
public string type get; set;
public string version get; set;
public string thumbnail_width get; set;
public string provider_url get; set;
public string thumbnail_height get; set;
public string html get; set;
public int height get; set;
public string thumbnail_url get; set;
c# facebook oembed
add a comment |
I'm trying to make a Get request to Facebook's Oembed endpoint from server side. When I just go to the URL in my browser it works (click this link: https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F)
However, when making the call from the server side, response isn't a json object.
static void Main(string[] args)
string uri2 = "https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F";
CreateLinkRequest call2 = new CreateLinkRequest();
call2 = Get<CreateLinkRequest>(uri2);
Console.ReadLine();
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
public class CreateLinkRequest
public string provider_name get; set;
public string author_name get; set;
public string width get; set;
public string author_url get; set;
public string title get; set;
public string type get; set;
public string version get; set;
public string thumbnail_width get; set;
public string provider_url get; set;
public string thumbnail_height get; set;
public string html get; set;
public int height get; set;
public string thumbnail_url get; set;
c# facebook oembed
I get their “upgrade your browser” page, when I make a “naked” server-side request for that URL. Try adding a User-Agent header to your request that matches a current browser.
– 04FS
Mar 27 at 7:14
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot.
– Matthew Webster
Mar 27 at 15:42
add a comment |
I'm trying to make a Get request to Facebook's Oembed endpoint from server side. When I just go to the URL in my browser it works (click this link: https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F)
However, when making the call from the server side, response isn't a json object.
static void Main(string[] args)
string uri2 = "https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F";
CreateLinkRequest call2 = new CreateLinkRequest();
call2 = Get<CreateLinkRequest>(uri2);
Console.ReadLine();
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
public class CreateLinkRequest
public string provider_name get; set;
public string author_name get; set;
public string width get; set;
public string author_url get; set;
public string title get; set;
public string type get; set;
public string version get; set;
public string thumbnail_width get; set;
public string provider_url get; set;
public string thumbnail_height get; set;
public string html get; set;
public int height get; set;
public string thumbnail_url get; set;
c# facebook oembed
I'm trying to make a Get request to Facebook's Oembed endpoint from server side. When I just go to the URL in my browser it works (click this link: https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F)
However, when making the call from the server side, response isn't a json object.
static void Main(string[] args)
string uri2 = "https://www.facebook.com/plugins/video/oembed.json/?url=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F";
CreateLinkRequest call2 = new CreateLinkRequest();
call2 = Get<CreateLinkRequest>(uri2);
Console.ReadLine();
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
public class CreateLinkRequest
public string provider_name get; set;
public string author_name get; set;
public string width get; set;
public string author_url get; set;
public string title get; set;
public string type get; set;
public string version get; set;
public string thumbnail_width get; set;
public string provider_url get; set;
public string thumbnail_height get; set;
public string html get; set;
public int height get; set;
public string thumbnail_url get; set;
c# facebook oembed
c# facebook oembed
edited Mar 27 at 3:48
Matthew Webster
asked Mar 27 at 3:33
Matthew WebsterMatthew Webster
61 silver badge3 bronze badges
61 silver badge3 bronze badges
I get their “upgrade your browser” page, when I make a “naked” server-side request for that URL. Try adding a User-Agent header to your request that matches a current browser.
– 04FS
Mar 27 at 7:14
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot.
– Matthew Webster
Mar 27 at 15:42
add a comment |
I get their “upgrade your browser” page, when I make a “naked” server-side request for that URL. Try adding a User-Agent header to your request that matches a current browser.
– 04FS
Mar 27 at 7:14
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot.
– Matthew Webster
Mar 27 at 15:42
I get their “upgrade your browser” page, when I make a “naked” server-side request for that URL. Try adding a User-Agent header to your request that matches a current browser.
– 04FS
Mar 27 at 7:14
I get their “upgrade your browser” page, when I make a “naked” server-side request for that URL. Try adding a User-Agent header to your request that matches a current browser.
– 04FS
Mar 27 at 7:14
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot.
– Matthew Webster
Mar 27 at 15:42
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot.
– Matthew Webster
Mar 27 at 15:42
add a comment |
1 Answer
1
active
oldest
votes
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369381%2ffacebook-oembed-response-not-returning-json%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
add a comment |
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
add a comment |
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot
public static T Get<T>(string uri)
DecompressionMethods.Deflate;
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
string json = reader.ReadToEnd();
Object result = new JavaScriptSerializer().Deserialize<T>(json);
return (T)result;
}
answered Mar 27 at 15:46
Matthew WebsterMatthew Webster
61 silver badge3 bronze badges
61 silver badge3 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55369381%2ffacebook-oembed-response-not-returning-json%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I get their “upgrade your browser” page, when I make a “naked” server-side request for that URL. Try adding a User-Agent header to your request that matches a current browser.
– 04FS
Mar 27 at 7:14
Figured it out, you were on the right path but I had to set the UserAgent and Refer properties on the HttPWebRequest. I guess facebook wants to make sure you're not a bot.
– Matthew Webster
Mar 27 at 15:42