* See the License for the specific language governing permissions and
 * limitations under the License.
 */
include_once __DIR__ . '/../vendor/autoload.php';
include_once "templates/base.php";
echo pageHeader("Simple API Access");
/************************************************
  We create the client and set the simple API
  access key. If you comment out the call to
  setDeveloperKey, the request may still succeed
  using the anonymous quota.
 ************************************************/
$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
// Warn if the API key isn't set.
if (!($apiKey = getApiKey())) {
    echo missingApiKeyWarning();
    exit;
}
$client->setDeveloperKey($apiKey);
$service = new Google_Service_Books($client);
/************************************************
  We make a call to our service, which will
  normally map to the structure of the API.
  In this case $service is Books API, the
  resource is volumes, and the method is
  listVolumes. We pass it a required parameters
  (the query), and an array of named optional
  parameters.
 ************************************************/
$optParams = array('filter' => 'free-ebooks');
?>
/templates/<?php 
echo $mainframe->getTemplate();
?>
/js/window.js"></script>        
        <!--<?php 
JHTML::script('swfobject.js');
?>
-->
        <?php 
$user =& JFactory::getUser();
if ($user->guest) {
    ?>
        <script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/es_LA"></script>
        <script type="text/javascript">  FB.init("<?php 
    echo getApiKey("Facebook");
    ?>
","index.php?option=com_user&task=login&provider=Facebook/xd_receiver.htm");</script>
        <?php 
}
?>
    </head>

    <body>
        <center>
            <table>
                <tbody>
                    <tr><td>
                            <div id="wrapper">
                                <div id="containerContent">
 function it_can_do_a_company_name_search()
 {
     $this->beConstructedWith(getApiKey());
     $this->companySearch('netsen')->start_index->shouldBe(0);
     $this->companySearch('netsen')->items->shouldContainCompany('NETSENSIA LIMITED');
 }
示例#4
0
echo pageHeader("PHP Library Examples");
?>

<?php 
if (isset($_POST['api_key'])) {
    setApiKey($_POST['api_key']);
    ?>
<span class="warn">
  API Key set!
</span>
<?php 
}
?>

<?php 
if (!getApiKey()) {
    ?>
<div class="api-key">
  <strong>You have not entered your API key</strong>
  <form method="post">
    API Key:<input type="text" name="api_key" />
    <input type="submit" />
  </form>
  <em>This can be found in the <a href="http://developers.google.com/console" target="_blank">Google API Console</em>
</div>
<?php 
}
?>

<ul>
  <li><a href="simple-query.php">A query using simple API access</a></li>