I created a Facebook App (Page Tab). This App can be added to Fanpages.
In this App, I make a call with Javascript to get the right JSON Data for my App.
The data is specific to the FB-Site where my App was been added.
I.e. when Coca-Cola adds my App to their Fan Page, I need to know that is coca cola - to get the right data.
Now, my Idea is when creating the Page Tab, save the ID from the Page. And when making a call to get the data in the page tab sending the Fanpage ID as a parameter.
I hope it is reasonably clear what I mean.
My Question is, how got access to ID of the Page?
Best with Javascript. Or is this not possible?
I would appreciate any tip!
This would be very easy with the PHP SDK. A signed_request parameter will get passed on to your iframe, and the PHP SDK offers a function called getSignedRequest() to parse it:
https://developers.facebook.com/docs/reference/php/facebook-getSignedRequest/
For example:
$sr = $fb->getSignedRequest();
echo $sr['page']['id'];
With JavaScript it would be a lot more complicated. You could try to get the signed_request parameter like this: How to retrieve GET parameters from javascript? - But you would have to deal with the parameter on your own. HereĀ“s how to parse the parameter on your own with PHP: https://developers.facebook.com/docs/facebook-login/using-login-with-games
No Facebook SDK needed in that case, btw. And it should also work with PHP <5.4.
Related
For example there is a table like in this link https://leetcode.com/contest/weekly-contest-309/ranking
How to access the database from where it is coming. Like let's say to get whole ranking table at a place
I tried reading HTML file but didn't get it
One extension scrapes the table only
How can we achieve this?
There is no simple answer here - it really depends how is it implemented on the server side. As rv.kvetch pointed you can get part of result from url:
https://leetcode.com/contest/api/ranking/weekly-contest-309/?pagination=1®ion=global
You can notice pagination query parameter here, indeed you can access second page, third page and so on. Sometimes there is some parameter like page_size implemented on server but it doesn't look like that case.
So to access full table you probably need to iterate over that pages and glue the results.
EDIT: How to get such url for some page?
Open your favorive browser, run web inspector (usually right click - inspect) and go to network tab, where you can find all requests sent during page rendering.
If you view the source of any LinkedIn profile then you can see information in this form
"firstName""Danish""
I don't know how to get this data
Here the first name is Danish
How can I get this record using jQuery or Javascript if I send GET request using jQuery on user links and get all the HTML, is it possible? or any solution for this problem
You shouldn't. You will be breaking their Terms. User their API.
https://www.linkedin.com/help/linkedin/answer/56347/prohibition-of-scraping-software?lang=en
So I'm trying to make a website where you put in a username and it will give you data about that username using an API. Right now I have it set up so you have to type the username in every time you're on the website, but I was wondering if it's possible to put the username in the link and still be able to retrieve it to put it into an API and use the API's response in the website?
For example, would it be possible to have something like http://website.com/?username=XXXXXXXXXand to be able to get the part after ?username= and to save it to a string or something to put into the API using JavaScript or jQuery? Any help would be appreciated :)
why don't you saving username in cookie/storage/session after user input?your ways is complex and unreliable.or may be you could use the rest url format like this: http://{username}.example.com/api or http://www.example.com/{user}/api then your backend always retrieves username from this path and you needn't add parameters manually.
I'm using VBA in excel to webscrape. I'm trying to pull down the URLs of links on a website.
Do a search on this website, with any of the checkboxes near the bottom checked:(http://www.fpi.co.za/YourFinancialPlanning/FindaFinancialPlanner/tabid/3255/Default.aspx)
You'll see there's a list of names here (advisers in south africa)
If you click on the name it will bring you to a new page. That being said, the method of URL change is actually through javascript __doPostBack, which means I can't simply getelementsbyclassname().href
I know that I can simply use VBA to click the link, and then store URL, but is there any way of obtaining that URL WITHOUT navigating to it?
This is the HREF I'm dealing with:
javascript:__doPostBack('dnn$ctr4953$Clients_Custom$ctl00$rg_Members$ctl00$ctl04$lnkName','')
Is there anything around postBackOptions.ActionURL or something?
The website is an ASP.Net application. The JavaScript is auto-generated by .Net engine, and the function __doPostBack() is simply posting the arguments back to the server which is then redirecting to the other page. This means that the URL is on the server not in JavaScript, so there is no way for you to find it.
I'm having a hard time figuring out how to do this,
Heres what I am trying to do:
I have a webpage containing statuses of users I've chose to follow(Something like facebook's statuses).
Now what am trying to do is to refresh the webpage automatically so that whenever a user changes his status I won't have to refresh the webpage to see it.
The status list is a Repeater located inside an UpdatePanel, it's data source is structure of List<User> I've created(there is no DB involved). Each user has an unique ID, name and status.
The users I follow is a List of strings containing the IDs of those users stored on the Session.
I have read countless articles about how to use a webservice and how to use javascript yet I remain clueless on how refresh the updatepanel's content automatically through the webservice.
Good example of using a timer (for an update panel) here:
http://msdn.microsoft.com/en-us/library/cc295400.aspx
Assuming you are using JQuery you can then call a webservice from this 'Timer_Tick()' method using the following:
JQuery & Timer :: Updating the text of a hyperlink from a webservice