Search code examples
phpvariablesscreenshotthumbnails

Passing a url as a variable into thumbalizr php


I am using the Thumbalizr API for capturing website screenshots.

I am trying to pass a url from a variable into the script below where it currently says "www.google.com".

When I try and do $url = "www.google.com"; and pass that to $image->request($url); it seems to fail and retrieves a screenshot but one that suggests the url was unreachable.

Any what am I doing wrong?

Here is the original php in full working order.

<?php

    define ("_THUMBALIZR",1);

    require_once("config.inc.php"); // get config and functions
    $image=new thumbalizrRequest(); // create object
    $image->request("www.google.com"); // send request

    if ($image->headers['Status']=="OK" || $image->headers['Status']=="LOCAL") { // if picture is available
     $image->output(); //dump binary image data
    } else {
     print_r($image->headers); // print text result output - you can dump your own "queued" picture here
    }

    ?>

Solution

  • If you show us your current code, IE the one with $url, that may help. In short, $url being used in place of "www.google.com" should not make a difference, as long as $url is being defined correctly and in the current scope (if inside of a function).

    Show the current and we can better help you solve this issue.