PHP Classes

Using the API for screenshots

Recommend this page to a friend!

      Webshots  >  All threads  >  Using the API for screenshots  >  (Un) Subscribe thread alerts  
Subject:Using the API for screenshots
Summary:Possible issues using webshots
Messages:3
Author:Darren Conyard
Date:2013-01-02 16:44:38
Update:2013-01-17 18:29:23
 

  1. Using the API for screenshots   Reply   Report abuse  
Picture of Darren Conyard Darren Conyard - 2013-01-02 16:44:38
Hi PLSCIS PLP,

I am relatively new in using PHP and I have some trouble in taking screenshots with the webshots class. I have signed up on your website http://www.plsein.tk/ and I can obtain the code and key that is needed from the profile page in order for the webshots to work.

However even though "image created" is displayed I cannot find the file on my server, I have made sure I have included the absolute file path for file I want to write to and I have checked to make sure that destination folder is writeable.

Is there anything that I might be missing in order for the file to created successfully?

Best Regards

Darren Conyard

  2. Re: Using the API for screenshots   Reply   Report abuse  
Picture of PLSCIS PLP PLSCIS PLP - 2013-01-11 19:31:23 - In reply to message 1 from Darren Conyard
Hi Darren,

In sample code file webshots_test.php, second line of code is:

$img = "/var/www/images/img.png";

this is the path where image will be created and stored.

Also, you will find code:

@ file_put_contents($img_path, $img);

in "webshots.php" file, there you can remove the "@" symbol from front and it will show you if any error while creating file.

To debug, in "webshots.php" there is code:

$img = $this->post_to_url($url, $params);
// print_r($img); exit;

uncomment the print_r statement to know what you get from the api call.

Hope this helps you to get through the issue.

  3. Re: Using the API for screenshots   Reply   Report abuse  
Picture of Darren Conyard Darren Conyard - 2013-01-17 18:29:23 - In reply to message 2 from PLSCIS PLP
Thanks.

I worked it out, the problem is I was using an incorrect file path, I was using an absolute file path for where I wanted the image to go, and it should be a relative filepath to the test document, this should also be without the "/" before the folder that you want to put the image into.

Thanks again

Darren