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 7642085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:06:00+00:00 2026-05-31T09:06:00+00:00

I am new in programing. I want to save images from Google Images. I

  • 0

I am new in programing. I want to save images from Google Images. I can use filter for only the free ones. I use a Google API, I have the URL and I want to pass it to PHP, but I don’t know how to pass it from JavaScript to PHP. I try it with forms, and document.write('<a href="prueba4.php?url1=unescapedUrl">save the image</a>'); but it doesn’t work.

function MyKeepHandler(result) {
    // clone the result html node
    var node = result.html.cloneNode(true);
    // attach it
    var savedResults = document.getElementById("content");
    savedResults.appendChild(node);
    // extract some info from the result to show to get at the individual attributes.
    // see http://code.google.com/apis/ajaxsearch/documentation/reference.html
    var title = result.title;
    var unformattedtitle = result.titleNoFormatting;
    var content = result.content;
    var unescapedUrl = result.unescapedUrl;

    document.write('<a href="prueba4.php?url1=unescapedUrl">save the image</a>');
    // alert("Saving " + unformattedtitle + " " + unescapedUrl + " " + content);
    var_dump($x);
}

function OnLoad() {
    // Create a search control
    var searchControl = new google.search.SearchControl();
    // Add in a WebSearch
    var webSearch = new google.search.WebSearch();
    // Add in a full set of searchers
    searchControl.addSearcher(new google.search.ImageSearch());
    //var localSearch = new google.search.LocalSearch();
    // tell the searcher to draw itself and tell it where to attach
    searchControl.draw(document.getElementById("content"));
    searchControl.setOnKeepCallback(this, MyKeepHandler);
    // execute an inital search
    searchControl.execute("tomates");
}

google.setOnLoadCallback(OnLoad);
</script>

</head>
<body style="font-family: Arial;border: 0 none;">
<div id="content">Loading...</div>
</body>
</html>

For saving an image I was using this (this works if I use URL-name):

function saveImage($url,$path) {
    $c = curl_init();
    curl_setopt($c,CURLOPT_URL,$url);
    curl_setopt($c,CURLOPT_HEADER,0);
    curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
    $s = curl_exec($c);
    curl_close($c);
    $f = fopen($path, 'wb');
    $z = fwrite($f,$s);
    if ($z != false) return true;
    return false;
}
saveImage($url1,$path);
  • 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-05-31T09:06:01+00:00Added an answer on May 31, 2026 at 9:06 am

    One thing I noticed:

    document.write('<a href="prueba4.php?url1=unescapedUrl">save the image</a>');
    

    There is no variable interpolation in JavaScript so this will output the exact text. Change it to:

    document.write('<a href="prueba4.php?url1=' + unescapedUrl + '">save the image</a>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am new to android programming and i want to create an api with
I am new to programming. I have lots of interest in networking and want
I'm new to C programming. I want to create C program which can read
I am new to C, and want to read some data from a file.
friends I am new in game development programing .And I want to understand the
i am new to iPhone programming i want to ask that whether i can
I'm quite new to android programming and I have the following problem. I want
I'm quite new to programing and have a problem. I have been using touchxml
I am new to c# programing.I want function like int system(command string) of c++
I'm new to programming with accelerometers on Android. I want to know how fast

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.