Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:36:32+00:00 2026-06-13T18:36:32+00:00

Hi I have the function below which grabs and saves screenshots. It works 50%

  • 0

Hi I have the function below which grabs and saves screenshots.
It works 50% of the time but it sometimes fails with the following message:
Warning: file_put_contents() expects at least 2 parameters, 1 given

I have dumped out the 2 parameters and can see that they both exist but the error message suggests otherwise

its driving me mad and any help would be appreciated..

<?php

grab_screenshot('http://www.usa4ink.com', 480, 240,"myscreen.jpg")

function grab_screenshot($url, $w, $h,$filename)
{
    global $imgPath;
    $filename = make_filename($filename,"jpg");
    $url = urlencode($url);
    $url = "http://s.wordpress.com/mshots/v1/$url/?w=$w&h=$h";
    $url = str_replace("//","/",$url);
    $url = str_replace("http:/","http://",$url);
    $image = file_get_contents($url);

    if($image!='')
    {
        file_put_contents(str_replace("//","/",$imgPath."/".get_subDir($filename)."/".$filename, $image));
    }
    return get_subDir($filename)."/".$filename;
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:36:34+00:00Added an answer on June 13, 2026 at 6:36 pm
    file_put_contents(str_replace("//","/",$imgPath."/".get_subDir($filename)."/".$filename, $image));
    

    Nope you dont. Look closer.

    file_put_contents(str_replace(param, param, param, param))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function below which works perfectly, but now the client came back
I have a following vb.net function as below in which i am passing a
I have a function(please see code below) which reads some data from the web.
I have a function which sorts data in a multidimensional array, as shown below:
I have a function to create a pdf which should return bitarray. Below is
I have the following function below: public function setupHead($title){ $displayHead .='<!DOCTYPE html PUBLIC -//W3C//DTD
I have a function below which is called to reload a recaptcha image. It
I have this function below which returns all IDs of checked boxes on my
I have the following code which grabs two separate arrays, flips the surname and
I have a javascript function below to move from select multiple box A which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.