1

I have downloaded and setup phpFlickr library but I need to use it from behind a proxy, so I have added the line to the example file and it throws an error. As its all pretty much out of the box, im flumaxed I also dont get the call to member function on a non object error it completely baffles me.

The readme paragraph

  1. Some people will need to ues phpFlickr from behind a proxy server. I've implemented a method that will allow you to use an HTTP proxy for all of your traffic. Let's say that you have a proxy server on your local server running at port 8181. This is the code you would use: $f = new phpFlickr("[api key]"); $f->setProxy("localhost", "8181"); After that, all of your calls will be automatically made through your proxy server.

The example.php file with my single modified line

require_once("phpFlickr.php");
$f = new phpFlickr("********************");
$f->setProxy("cache.mysite.org.uk", "80");

$recent = $f->photos_getRecent();

foreach ($recent['photo'] as $photo) {

$owner = $f->people_getInfo($photo['owner']);
echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>";
echo $photo['title'];
echo "</a> Owner: ";
echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>";
echo $owner['username'];
echo "</a><br>";

}

Any idea why im getting the following error Call to a member function setProxy() on a non-object in public_html/phpFlickr/phpFlickr.php on line 338

That code is

#336    function setProxy ($server, $port) {
#337            // Sets the proxy for all phpFlickr calls.
#338            $this->req->setProxy($server, $port);
    }
Charles
  • 50,943
  • 13
  • 104
  • 142
Paul M
  • 3,937
  • 9
  • 45
  • 53

0 Answers0