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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:42:00+00:00 2026-06-10T20:42:00+00:00

I made a nice simple userscript: When I browse the web, I can bookmark

  • 0

I made a nice simple userscript:
When I browse the web, I can “bookmark” any image in 1 click
My userscript

  1. Grab the img src
  2. Grab the url of the webpage
  3. Copy the .jpg .png .gif to my server

Everything works perfectly, BUT in some cases, the script cannot copy the file…
Actually the file is created but do not contains the img data, it only contains the content of an error webpage:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /data/x/xxx_xxx_x.jpg on this server.</p>
<p>Additionally, a 403 Forbidden
error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache Server at xxxxxxxx.net Port 80</address>
</body></html>

The “copy” code (php):

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $urlimg); 
curl_setopt($ch, CURLOPT_HEADER, false); 
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
set_time_limit(300); # 5 minutes for PHP 
curl_setopt($ch, CURLOPT_TIMEOUT, 300); # and also for CURL 
$path = $dirpix.'/'.$aa.'/'.$mm;
if ( ! is_dir($path)) {
    mkdir($path);
}
$outfile = fopen($path.'/'.$id.'.'.$ext, 'wb'); 
curl_setopt($ch, CURLOPT_FILE, $outfile); 
curl_exec($ch); 
fclose($outfile); 
curl_close($ch); 

Maybe the website blocks that kind of “copy” script?
Thanks!

  • 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-10T20:42:02+00:00Added an answer on June 10, 2026 at 8:42 pm

    2 things I can think of here are,

    1. Set a user agent to your curl request. Because from what you say, you are able to view the image but curl is getting 403 error, it could very well be userAgent filtering on server side.

    2. Add referer to your curl request. You can send the referer information from your userscript to the php script. You’d have to post or get window.location.href‘s value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a simple web service which worked nice with few systems that it
how can i made some nice slideshow for the index.html page, with lets say
Made this nice little loop for hiding and showing div's, works as a charm
On Diveboard, we made a nice hack of photoswipe to support videos Everything went
What grid library does swivel.com use? It looks pretty nice. Is it made inhouse?
I made an iphone app to capture image from camera and to set that
I made a Web service in which I have a function to count some
I am creating a logging facility for my library, and have made some nice
EDIT: This is a nice ready-made menubar application here ( github source ) by
It's often the case that I can write a nice tight little VB.NET function,

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.