php site w Google Form embedded - php

i have a php site in development wh runs fine.
i have included a google spreadsheet form in it via the iframe tags that Google ask you to copy and paste
the spreadsheet form is obviously there for users to use.
it would be all be so great but I can't see how to get the users id from the parent page into the google form via the iframe
i need this otherwise i won't know who it is who has submitted the form. yes, I cld ask the user to type in their name again but think that's a bit clunky particularly since the info is floating about in the parent page framing the iframe.
Tom

Why not create a php page which takes the user ID in the query string, then redirects to the correct spreadsheet? Just set that page as the src of your iframe with the proper user id in the query string, and voila.

Related

How to auto fill Text box in php (Similar to Facebook)

What I am trying to do is to make something similar to what I see all the time on almost any website. The button that says Share to facebook. The goal for me is to let my guests share the item they are viewing in my store (Ran on prestashop) on their blog I run (Running on Oxwall).
The goal is for the button to not only link to a blog post submission webpage but to already have the subject line filled out with the item they are sharing's name and the blog post to display the information about the item. I would like to try and do all this using PHP. I am not sure how to go about doing it but I am sure that I could pass the value. Please note that I can mod BOTH the blog site and the shop as I run both and want to connect them.
As an extra bonus I am also running a forum using phpbb3 if I could do the same thing but onto that as well I would greatly thank you. I am trying to interlink everything into one big network. I know its not an easy task but I am sure there is an easy way to pass data onto the other site so that this can be done.
Facebook a 2 tools to get items informations in the page, it parses the page looking for the most common tags and it uses OpenGraph.
You can also provide product informations in the head of your page (between head tags), then blog side, you retrieve only the contents and parse it as XML.
I advise you to cache this data to avoid useless connections between websites and awful overloads while parsing.
You can use your own specifications, Open Graph or another standard, but i advise to use a standard.

Get facebook current location and hometown of public profile

how to get usernames and ids from this type of search? All the information is public here in this link. So how can i get a json data of the complete set of users.
https://www.facebook.com/search/108424279189115/residents/present/104057239629661/home-residents/intersect
In the link above, i have used 2 locations,
Hometown:Guntur
current location: Newyork
I have written some script for downloading ID's for targeting purpose. I have used chrome dev tools to grab ID's of users.
JAVASCRIPT in Browser console helped me to achieve this.
Bookmarklet the javascript code attached here and open that link and click the bookmarklet. Thats it, Page scrolls for some time and a file gets downloaded which contains ID's of the user.
Its just a work around as we dont have an API for this.

Ajax page fetch design requires physical address

I am creating a web app in php. i am loading content through a ajax based request.
when i click on a hyperlink, the corresponding page gets fetched through ajax and the content is replaced by the fetched page.
now the issue is, i need a physical href so that i can implement facebook like functionality and also maintain the browser history property. i cannot do a old school POSTBACK to the php page as I am doing a transition animation in which the current page slides away and the new page slides in.
Is there a way I can keep the animation and still have a valid physical href and history.
the design of the application is such:
the app grabs an rss feed.
it creates the DOM for those rss feeds.
upon clicking on any headline, the page animates and takes to the full story of the rss feed.
i need to create "like" button on the full story page. but i dont have a valid url.
While Alexander's answer works great on the client side, Facebook's linter tool does not run javascript, so it will get the old content. Neither of the two links provide a solution to this.
What amit needs to implement is server-side parsing of the url. See http://www.php.net/manual/en/function.parse-url.php. Fragment is what the server sees as the hash tag value. In your php code, render the correct og: tags for based upon the fragment.
Firstly, if you need a URL for facebook then think up a structure that gives you one, such that your server-side code will load the correct page when given that URL. This could be something like http://yourdomain.com/page.php?feed=<feedname>&link=<linknumber>, which would allow you to check the parameters using the PHP $_GET array. If you don't have the parameters then load the index page; if you do then load the relevant article.
Secondly, use something like history.js to give you cross-browser support for the HTML5 pushState() functionality so that you can set the page URL when you do the AJAX call, without requiring the browser to do a full reload.
You have to implement hash navigation.
Here is short tutorial.
Here is more conceptual introduction.
If you're using jQuery, I can recommend BBQ for hash navigation:
http://benalman.com/projects/jquery-bbq-plugin/
This actually sounds pretty straight forward to me.
You have the urls as usual, using hash (#) you can extract the info both in the client and server side.
There is only one thing that is missing, on the server side before you return the content, check the user agent string and compare it to the facebook bot (if i'm not mistaken it's something like "facebookexternalhit"), if it turns out to be the facebook bot then return what ever you want which describes the url for a like/share (open graph meta data), and if it's any other user agent string return the content as usual.

Need Correct Open Graph Meta Tags When PHP Data Passed Through URL

I'm creating a site utilizing PHP that draws data from a mySQL database. The content that is drawn is constantly changing and linked to a unique ID. Although a lot of content is pulled on a main page, each facebook-send button links to the contents unique ID on a separate page. I'm passing the information through the URL in the facebook send (ie. link: www.example.com/info.php?id=5 )
My problem is that the send button is not recognizing the Open Graph Meta tags for the page - it displays the wrong picture and wrong title. I've tested with the debugger - and it works for the receiving page (www.example.com/info.php), but not with the added data. That said, once I plug in the full URL with data (www.example.com/info.php?id=5) into the debugger - that page gets crawled & all send buttons linking to that exact URL now populate with the correct picture and title.
Because the content on my site is constantly changing I can't manually have facebook crawl each page of potential URLs with each data ID. Is there a way I can pass data through the URL and have facebook-send button recognize the Open Graph Meta Tags on the receiving page to display for every potential ID? Note: it's just one picture and title I want for all links.
I thank you in advance for your time, I'm slightly new to programming and your help is sincerely appreciated!
We do a lazy crawl, so the first person to Send might not get the image right away, but if you wait 30 seconds and try again it should show up.

Using YQL in javascript/php to scrape article html?

I'm new to YQL, and just trying to learn how to do some fairly simple tasks.
Let's say I have a list of URLs and I want to get their HTML source as a string in javascript (so I can later insert it to a database via ajax). How would I go about getting this info back in Javascript? Or would I have to do it in PHP? I'm fine with either, really - whatever can work.
Here's the example queries I'd run on their console:
select * from html where url="http://en.wikipedia.org/wiki/Baroque_music"
And the goal is to essentially save the HTML or maybe just the text or something, as a string.
How would I go about doing this? I somewhat understand how the querying works, but not really how to integrate with javascript and/or php (say I have a list of URLs and I want to loop through them, getting the html at each one and saving it somewhere).
Thanks.
You can't read other pages with Javascript due to a built-in security feature in web browsers. It is called the Same origin policy.
The usual method is to scrape the content of these sites from the server using PHP.
There is an other option with javascript called a bookmarklet.
You can add the bookmarklet in your bookmarks bar, and each time you want the content of a site click the bookmark.
A script will be loaded in the host page, it can read the content and post it back to your server.
Oddly enough, the same origin policy, does not prevent you to POST data from this host page to your domain. You need to POST a FORM to an IFRAME that has a source hosted on your domain.
You won't be able to read the response you get back from the POST.
But you can poll with a setInterval making a JSONP call to your domain to know if the POST was successful.

Categories