*update* For anyone else with the same problem, the easy fix is to use Parse_str on your php side;
http://php.net/manual/en/function.parse-str.php You can then use the returned array like you would the built in query- string parsing functions. On Jul 27, 2:45 pm, Thomas Wrobel <darkfl...@gmail.com> wrote: > Thanks for the clarification. > > The problem is, to my knowledge, you can't use the built in parser in > PHP to parse your own strings, it only reads from the URL. > So while you can get the original query string by doing; > $_GET['_escaped_fragment_'], if you got multiple parameters you then > have to parse over it yourself. > > And thanks for the unescape reminder! > > On 27 July 2010 14:35, Katharina Probst <kpro...@google.com> wrote: > > > > > > > On Mon, Jul 26, 2010 at 8:31 PM, Thomas Wrobel <darkfl...@gmail.com> wrote: > > >> Sorry for my late reply. > >> Lets say I have a url like this; > > >>http://www.rateoholic.co.uk/main/Rateoholic_Frame.html#!SEARCHFOR=sta... > > >> Google Bot will turn it to this; > > >>http://www.rateoholic.co.uk/main/Rateoholic_Frame.html?_escaped_fragm... > > > It should be: > >http://www.rateoholic.co.uk/main/Rateoholic_Frame.html?_escaped_fragm... > > > (note the = after the _escaped_fragment_) > > What I thought you'd do in PhP is something like > > $_GET['_escaped_fragment_'], then take that string, unescape it, and you've > > got your query params back (your first workaround). But I do see the > > problem that it's slightly less convenient... With both of your suggested > > workarounds, just remember to unescape the keys and values afterwards. It > > *would* be nice to have a handy little parser for this. > > kathrin > > >> Correct? > > >> Now, in PHP you normally access the query string data by calls like > >> $_GET[]. > >> Only in this case if you call $_GET['SEARCHFOR'] you wont get the > >> value "star wars" like you normally would, because google bot has > >> added "_escaped_fragment_" to the start of the key value. > >> You could still get the other key/value pairs just fine following the > >> "&" sign, but the first one be visible in the normal way. > > >> See the problem? > > >> I've come up with some solutions, but they arn't that pretty. > >> One way is to remove the _escaped_fragment_ from the start of the > >> string and make my own parser for the key/value pairs. > > >> The other is to search for $_GET['_escaped_fragment_SEARCHFOR'] > >> instead of SEARCHFOR. However, this results in the query string > >> needing to be in a fixed order. (or testing for both > >> "_escaped_fragment_****** " and ****** for every key I'm looking for). > > >> Its not a critical problem, as the first workaround works and am > >> currently using it. > > >> But it does seem like there should be some nice method to be able to > >> use PHP's query-string functions as intended. > > >> === > >> Finally, one last thing; I cant work out any way to tell when my > >> system is working or not. After a few days my #! results dont seem > >> googlable...so can I assume it isn't working yet for some reason? (Ive > >> submitted a sitemap thats parsed over ok...so I expected > >> something..hmm..) > > >> Thanks, > >> Thomas Wrobel > > >> On 26 July 2010 14:45, Katharina Probst <kpro...@google.com> wrote: > >> > Sorry, I'm a little confused too. > >> > When googlebot seeswww.example.com?mykey=myvalue#!myhistorytoken, > >> > it'll turn it into > >> >www.example.com?mykey=myvalue&_escaped_fragment_=myhistorytoken. > >> > Can you give an example (complete fake URLs, like I did above) to > >> > illustrate > >> > the problem you're seeing? That would be helpful. > >> > Thanks, > >> > kathrin > >> > Short answer is I don't think you should use #!&. > > >> > On Sat, Jul 24, 2010 at 12:27 PM, darkflame <darkfl...@gmail.com> wrote: > > >> >> Thanks, Sorry if its not clear, but I am actually talking about all of > >> >> those things. > > >> >> PHP is my back end which is generating the static pages. > >> >> GWT is what my site is coded in. Its completely dynamic and makes > >> >> extensive use of "#" tokens to store and retrieve its states. > > >> >> I'm attempting to get my side Ajax crawl-able using this guide; > >> >>http://code.google.com/web/ajaxcrawling/docs/getting-started.html > > >> >> This guide states to replace the normal "#anything" style history > >> >> tokens with "#!anything" tokens instead. Note the additional "!" > >> >> When google's crawler is requesting these pages it swaps the "#!" for > >> >> "?_escapedfragment_=", allowing the server to generate a static page > >> >> using the query string. > >> >> This is all laid out in googles guide. > > >> >> However, the formating of this "?_escapedfragment_=" does not allow > >> >> php to process the key/value pairs in the query string as it normally > >> >> could. > >> >> PHP can normally read of key value pairs from the query string using > >> >> its $_GET[] command. However, under this system "?_escapedfragment_=" > >> >> in the url requested prevents the first key value pair being read. > >> >> (as the parser now sees "_escapedfragment_" as its own key, and the > >> >> first true key as its *value*). > > >> >> Thus, in order to use PHP with Google's system for making Ajax > >> >> crawlable, I was querying if GWT user's should add "&" to their new > >> >> history token format, rather then just "!". So the new tokens become > >> >> "#!&" rather then just "#!". > >> >> ---- > >> >> This is a little confusing, but I think it should be understandable > >> >> for anyone who knows both PHP as well as GWT. (or at least, has used > >> >> extensive historytokens/states in their web design). > > >> >> Finally, I mentioned the Webmaster tools "Fetch as Googlebot" as thats > >> >> what I'm using to test if my site is indeed browse-able by google's > >> >> bot. Its not yet possible to use it to test completely for this sort > >> >> of functionality, however. So some of this work is a little "blind". > > >> >> On Jul 24, 6:08 pm, Stefan Bachert <stefanbach...@yahoo.de> wrote: > >> >> > Hi, > > >> >> > when others are as confused as me than you will get no qualified > >> >> > answer > > >> >> > You are talking about PHP, url, google and sometimes it sounds that > >> >> > you are talking about > >> >> > Google Webmaster Tools. ( != GWT = Google Webtool Kit) > > >> >> > Stefan Bachert > >> >> > http::/gwtworld.de > > >> >> > Inquiries for professional GWT support are welcome. > >> >> > I am sorry, I won't do free personal support. > > >> >> > On 23 Jul., 15:59, darkflame <darkfl...@gmail.com> wrote: > > >> >> > > (of course, Id have to code my gwt java to remove the "&" from the > >> >> > > history string before processing) > > >> >> > > On Jul 23, 3:54 pm, darkflame <darkfl...@gmail.com> wrote: > > >> >> > > > Ive noticed that if I change my links to just "#!" google > >> >> > > > interprets > >> >> > > > them as; > >> >> > > > "_escaped_fragment_=" > > >> >> > > > Which is how its documented. > >> >> > > > However, this means a php $_GET command cant read the first > >> >> > > > key/value > >> >> > > > listed. > > >> >> > > > So; > > >> >> > > > $_GET['DisplayReview'] returns as empty if the url is, say, "? > >> >> > > > _escaped_fragment_=DisplayReview=123" > > >> >> > > > If, however, I use "#!&" on my Javascript, then google will > >> >> > > > instead > >> >> > > > call; > > >> >> > > > "_escaped_fragment_=&" and $_GET['DisplayReview'] returns the > >> >> > > > correct value. > > >> >> > > > Is this acceptable? Should this be standard practice for those > >> >> > > > using > >> >> > > > php to generate the static pages? > > >> >> > > > The alternative seems to be manually parsing the whole query > >> >> > > > string > >> >> > > > rather then using $_GET[], but that seems rather messy. > > >> >> > > > ---- > >> >> > > > Note; I'm making some assumptions about how google replaces the > >> >> > > > "#!", > >> >> > > > as the "Fetch as Robot" utility doesn't seem to do it yet. > > >> >> -- > >> >> You received this message because you are subscribed to the Google > >> >> Groups > >> >> "Google Web Toolkit" group. > >> >> To post to this group, send email to > >> >> google-web-tool...@googlegroups.com. > >> >> To unsubscribe from this group, send email to > >> >> google-web-toolkit+unsubscr...@googlegroups.com. > >> >> For more options, visit this group at > >> >>http://groups.google.com/group/google-web-toolkit?hl=en. > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups > >> > "Google Web Toolkit" group. > >> > To post to this group, send email to > >> > google-web-tool...@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > google-web-toolkit+unsubscr...@googlegroups.com. > >> > For more options, visit this group at > >> >http://groups.google.com/group/google-web-toolkit?hl=en. > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Google Web Toolkit" group. > >> To post to this group, send email to google-web-tool...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> google-web-toolkit+unsubscr...@googlegroups.com. > >> For more options, visit this group at > >>http://groups.google.com/group/google-web-toolkit?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to google-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com. > > For more options, visit this group at > >http://groups.google.com/group/google-web-toolkit?hl=en. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.