bonjour a tous,

Je commence un petit developpement en rapport avec l'API Goole Books.
Apres de multiples recherche il me reste deux erreurs que je n'arrive pas à résoudre :

La 1ere : Notice: Undefined variable: httpClient in C:\Fichiers\Developpement\Sites Web\Local\galmiore.free.fr\listing3.php on line 37
Elle apparait non pas au load de la page mais apres que j'ai cliqué sur mon bouton de recherche
La ligne de mon code (que je vais coller plus bas) qui corresponds a cette erreur est
Code : Sélectionner tout - Visualiser dans une fenêtre à part
$books = new Zend_Gdata_Books($httpClient);
la 2nd :Notice: Undefined offset: 0 in C:\Fichiers\Developpement\Sites Web\Local\galmiore.free.fr\listing3.php on line 165
elle apparait presque a toutes les lignes.
La ligne de mon code (que je vais coller plus bas) qui corresponds a cette erreur est
Code : Sélectionner tout - Visualiser dans une fenêtre à part
$book->subject = is_object($arr[0]) ?
et voici la totalité du code que j'ai construit en puisant des ressources à droite et à gauche :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
 
<?php
 
// start a new session 
session_start();
 
if (isset($_POST['submit'])) {
 
// load Zend Gdata libraries
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Books');
Zend_Loader::loadClass('Zend_Gdata_Books_VolumeQuery');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
 
function getAuthSubRequestUrl()
{
    $next = 'http://www.example.com/welcome.php';
    $scope = 'http://www.google.com/books/feeds';
    $secure = false;
    $session = true;
    return Zend_Gdata_AuthSub::getAuthSubTokenUri($next, $scope, $secure, $session);
}
 
function getAuthSubHttpClient()
{
    if (!isset($_SESSION['sessionToken']) && !isset($_GET['token']) ){
        echo '<a href="' . getAuthSubRequestUrl() . '">Login!</a>';
        return;
    } else if (!isset($_SESSION['sessionToken']) && isset($_GET['token'])) {
      $_SESSION['sessionToken'] = Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
    }
 
    $httpClient = Zend_Gdata_AuthSub::getHttpClient($_SESSION['sessionToken']);
    return $httpClient;
}
 
 //$books = new Zend_Gdata_Books($httpClient, $applicationId, $clientId);
$books = new Zend_Gdata_Books($httpClient);
 
try {
 // prepare and execute search query
    $query = new Zend_Gdata_Books_VolumeQuery;
    $queryStr = '';
    if (!empty($_POST['title'])) {
      $queryStr .= '+intitle:'.urlencode($_POST['title']);
    }
    if (!empty($_POST['author'])) {
      $queryStr .= '+inauthor:'.urlencode($_POST['author']);
    }    
    $query->setQuery($queryStr);
    $query->setMinViewability($_POST['v']);
    $query->setMaxResults(20);
 
    $feed = $books->getVolumeFeed($query);  
  } catch (Exception $e) {
    die('ERROR:' . $e->getMessage());  
  }
}  
?>
<!DOCTYPE html 
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  <head>
    <title>Searching for book titles</title>
    <style>
    .entry {
      height: 120px;
      border-bottom: dashed silver 2px;
      padding-top: 10px;
    }
 
    .thumbnail {
      float: left;  
      border: solid black 2px;
      padding: 2px;
      margin-right: 10px;
    }
 
    .desc {
      font-style: italic;  
    }
 
    .small {
      font-size: smaller;  
    }    
    </style>    
  </head>
  <body>
 
    <h2>Search</h2>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    Title: 
    <input type="text" name="title" value="<?php echo isset($_POST['title']) ? 
     $_POST['title'] : ''; ?>" />
 
    Author: 
    <input type="text" name="author" value="<?php echo isset($_POST['author']) ? 
     $_POST['author'] : ''; ?>" />
 
    Viewability:
    <select name="v">
      <option value="none">Any</option>
      <option value="partial_view">Partial</option>
      <option value="full_view">Full</option>
    </select>    
 
    <input type="submit" name="submit" value="Go" />
    </form>
 
    <?php if (isset($feed)): ?>
      <h2>Search results for '<?php echo $query->getQuery(); ?>'
      </h2>
      <div>
      <?php echo $feed->totalResults; ?> result(s) found.
      </div>
 
      <div id="results">
      <?php $x = 1; ?>
      <?php foreach ($feed as $entry): ?>
 
        <?php    
        //print_r($entry);   
        $book = new stdClass;
 
        // get title
        if (is_array($entry->getTitles())) {
          foreach ($entry->getTitles() as $title) {
            $book->titles[] = $title->getText(); 
          }
        }
 
        // get authors
        if (is_array($entry->getCreators())) {
          foreach ($entry->getCreators() as $creator) {
            $book->authors[] = $creator->getText(); 
          }
        }
 
        // get publishers
        if (is_array($entry->getPublishers())) {
          foreach ($entry->getPublishers() as $publisher) {
            $book->publishers[] = $publisher->getText(); 
          }
        }
 
        // get publication date
        if (is_array($entry->getDates())) {
          $arr = $entry->getDates();
          $book->pubdate = (is_object($arr[0])) ? 
           $arr[0]->getText() : 'Unspecified'; 
        }
 
        // get ISBN numbers
        if (is_array($entry->getIdentifiers())) {
          foreach ($entry->getIdentifiers() as $id) {
            if (preg_match('/ISBN/', $id->getText())) {
              $book->isbn[] = $id->getText(); 
            }  
          }
        }
 
        // get first subject
        if (is_array($entry->getSubjects())) {
          $arr = $entry->getSubjects();
          $book->subject = is_object($arr[0]) ? 
           $arr[0]->getText() : 'Unspecified'; 
        }
 
        // get first description
        if (is_array($entry->getDescriptions())) {
          $arr = $entry->getDescriptions();
          $book->desc = is_object($arr[0]) ? 
           $arr[0]->getText() : 'No description available'; 
        }            
        ?>
 
        <div class="entry">
          <div class="thumbnail">
            <img src="<?php echo ($entry->getThumbnailLink()) ? 
             $entry->getThumbnailLink()->getHref() : ''; ?>" />      
          </div>
          <div class="data">
          <?php echo $x; ?>. <?php echo ucwords(@implode(': ', 
           $book->titles)); ?><br/>
          <?php echo @implode(', ', $book->authors); ?> |
          <?php echo @implode(', ', $book->publishers); ?> |
          <?php echo $book->subject; ?> |
          <?php echo date('d M Y', strtotime($book->pubdate)); ?> <br/>
          <span class="desc"><?php echo $book->desc; ?></span> 
          <br/>
          <span class="small"><?php echo @implode(', ', $book->isbn); ?> |       
            <a href="<?php echo $entry->getInfoLink()->getHref(); ?>">
            More information</a>   
          </span>
          </div>
        </div>      
        <?php $x++; ?>
      <?php endforeach; ?>
    <?php endif; ?>
 
  </body>
</html>
Quelqu'un pourrait il m'expliquer afin que je comprenne et ne plus recommetre ces erreurs?

Merci d'avance a celui et ceux qui auront pris le tps de lire ceci et d'y repondre.

Anax