Google Slides API pages.get() - php

I'm currently trying the Slides Google API and I've done the quick start guide so I could understand how this works (I have to say I'm not a expert developer).
After trying different things, I have reached a problem.
I have a presentation on my Google Drive which I want to try things on.
So far I've made that the code on the quick start guide works on a server, not in command line like it's showed.
Now I want to try new things but there is a problem with something.
And the code is
$slidesService = new Google_Service_Slides($client);
$presentations = $slidesService->presentations;
$pages = $slidesService->pages;
The error is:
Undefined property: Google_Service_Slides_Resource_Presentations::$pages
What might be wrong?

Based on the generated source of the Slides PHP client, I think you want $slidesService->presentations_pages.

Related

basic PHP API configuration - need to shorten php api code

I'm trying to figure out a way to shorten the php code that will display every asteroid name in the NASA's neo (near earth objects) API : https://api.nasa.gov/neo/rest/v1/neo/browse?page=0
So far I'm using something like this:
echo "<h4>//The asteroid name:</h4>";
echo( $data["near_earth_objects"]["2010-05-29"][2]["name"]);
Is there a more efficient way I can configure the php code to automatically grab every "$data["near_earth_objects"]" from the api code with the nasa's link to the asteroid info?
Thank you in advance for the help

How to cure a "Illegal string offset" php error in an unmaintained wordpress plugin

I am not a php programmer so this is as clear as mud to me.
Wordpress plugin is WP Custom Search Version: 0.3.26 It seems to be the only remotely usable plugin that will allow me to create a multi field search form for the sidebar of a site. It works reasonably well on my WAMP installation on the office PC but throws the error below when I moved it up onto the client's hosting on a GoDaddy VPS.
Warning: Illegal string offset 'preset' in /home/clubfund/public_html/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 401
The error appears to refer to this section of the php code.
function process_shortcode($atts,$content){
return $this->generate_from_tag(array("",$atts['preset']));
}
Most answers to similar questions refer to confusion between string and array values. I wouldn't know where to start despite having read through many similar questions and solutions. Unfortunately the plugin creator doesn't seem to be able to respond to questions. I wondered if anyone here would be willing to help.
Many thanks in advance.
You probably have different error levels in production and development. The issue is probably happening locally as well, you just don't see it being logged. Anyways, the issue is that the array key preset doesn't exist in the $atts array.
To remedy this you could do this right above the return line -
if(!array_key_exists($atts, "preset"))
{
$atts["preset"] = "";
}
That will set the value to an empty string if it isn't already set.
If you aren't sure what is actually being passed in, you could do something like- var_dump($atts) or gettype($atts) to see if the type is even an array.
Do not put the shortcode in your template, put the long code:
<?php if(function_exists('wp_custom_fields_search'))
wp_custom_fields_search(); ?>
I also had the same problem and already this solved it.

Easy way to make a line graph from MySQL results in Android?

I need to make an activity that displays results from a MySQL query in a line graph. Does anyone know a tutorial for beginners or sample code I could look at to accomplish this? All of my results are going to be integers of 0-10 to keep things simple if that matters.
Thanks!
This may get you started if you want to create a line graph from scratch:
How to draw a line in android
It really depends how much of this work you want to do yourself. You could probably find an open source line graph library somewhere as well.

RenRen social network app issues! Getting PHP errors... Any chinese to help? :)

I'm trying to build an app for the Chinese audience at the social networking site RenRen.
Using their PHP API I'm getting these errors:
Notice: Undefined index:
xn_sig_session_key in
C:\renren_test_app\xiaonei.class.php
on line 21
Notice: Undefined index: xn_sig_user
in C:\renren_test_app\header.php on
line 61
That's coming from the example PHP app. All I changed in code (at header.php) is the API key/secret.
I'd like to know how to fix this as this looks very fundamental.............. and if someone willing to be more helpful - how do I get; User's name/pic/id.
I do not understand Chinese at all so it makes things a lot harder on me. I'd appriciate if someone posts some code!
I hope someone smarter than me can help here (:
Edit:
Got the PHP API from: http://wiki.dev.renren.com/wiki/%25E4%25B8%258B%25E8%25BD%25BD%25E4%25B8%2593%25E5%258C%25BA
Your iframe shows that xn_sig_added=0, which means that 授权 (authorization) is not yet approved.
xn_sig_added = 1 表示已授权,此时应用就可以获取到
xn_sig_session_key 和 xn_sig_user 了。
Translate to:
xn_sig_added = 1, which means it's
authorized, at this point you could
retrieve xn_sig_session_key and
xn_sig_user.
Source: Wiki renren
The 3 ways you can ask for authorization is in the wiki, have a look (use google translate or something).
Hope it helps.
P/S: this is the first time I heard of Renren, it certainly looks like facebook!

PHP - import data into a excel template

first off I am fairly new to php like 3 weeks working with it, and am loving it so far. Its a fantastic language.
I am running into a issue though, I have a client who wants the information collected in on a form on this website to then be imported into a excel documents that he already has created. Since I am fairly new I've been googleing for the past two hours and have come up with so many different answers that my head is spinning.
I was wondering if someone can instruct me if first this can be done and what is the best method.
Or if you know a website that might have already explained this in a simple way if you could direct me to that.
Thanks guys, hopefully someday I can be as smart as you :)
Peace
To start with, you're going to need a library capable of reading your Excel template, such as PHPExcel, which you can then populate with the data from the form and save
Hey Chris, Sounds like what you are needing to do is call a COM object (Excel automation), from PHP. I Googled calling COM objects from PHP and found a site that suggested doing something like this.. the sample is for word but it should be simple to translate the idea to excel.. As discussed below, can you assume windows? Is this code running against excel on the browser machine or against some excel data on the server?
<?
$word=new COM("word.application") or die("Cannot start word for you");
print "Loaded word version ($word->Version)\n";
$word->visible =1;
$word->Documents->Add();
$word->Selection->Typetext("Dit is een test");
New efficiencies lie ahead
See the new IBM System x3650 M3 Express$word->Documents[1]->SaveAs("burb ofzo.doc");
$word->Quit();
?>
Here is a link to using COM from PHP:
PHP: COM
Saving the data in a .csv (comma delimited) file may be a quick option if you can arrange the spreadsheet at all.
Our answer is to save them as is into the database and convert them to <BR> for display to a web page. That way if a non-web program looks at the data, it will display semi-correctly without change. Yes some things won't always display properly for the program, but they will for the web page.

Categories