473,480 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Possible to get modified date of external image with curl?

Sav
I'm using curl to scrape an image file from an external server (see
code below). Is there any way to determine the external image file's
modified date? Ideally, I'd like to only process the image if it's
new.

$source = "http://www.example.com/image.jpg";
$ch = curl_init ($source);
$fp = fopen ($fileOriginal, "w");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
Jun 27 '08 #1
2 1712
On Jun 23, 2:37 am, Sav <savar...@gmail.comwrote:
I'm using curl to scrape an image file from an external server (see
code below). Is there any way to determine the external image file's
modified date? Ideally, I'd like to only process the image if it's
new.

$source = "http://www.example.com/image.jpg";
$ch = curl_init ($source);
$fp = fopen ($fileOriginal, "w");
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
It may there in the headers. But its not a required header. Why not
just apply the caching rules which came with the image?

C.
Jun 27 '08 #2
Sav
On Jun 23, 5:37 am, "C. (http://symcbean.blogspot.com/)"
<colin.mckin...@gmail.comwrote:
Why not just apply the caching rules which came with the image?
How do I do that?
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
5769
by: typingcat | last post by:
Is it possible to read another web page in PHP? If is ASP.NET, the code would be ------------ WebRequest req=WebRequest.Create("http://www.microsoft.com"); WebResponse res=req.GetResponse();...
3
7287
by: Tim | last post by:
Hi all, I would like to reference a remote image, such as http://www.mysite.com/pic.jpg and save it to a local folder such as c:\pics Can this be done with ASP? I have played with many...
102
6680
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem...
8
4036
by: chiefbutz | last post by:
I am trying to compile an app that uses the libcurl API. I have the files for that in the correct places. Then I compile I get the following: "Error: Unresolved ecternal '_curl_easy_init'...
3
1216
by: crescent_au | last post by:
hi all, i am creating a form that returns to itself like this: <form name="form1" action="<?php echo $_REQUEST; ?>" method="post"> Upon clicking submit, I want the form to return to "itself"...
2
3142
by: Enter The | last post by:
Hi, I'm trying to write a php script to open an external web page. Fill in a form. Submit the form. And then retrieve the data. For example, From my script, I'm looking to open up a google...
3
10347
by: JDS | last post by:
So, I'd like to create the following scenario: 1) Use cURL library within PHP (cURL + "Cookie Jar", et.al) to create a virtual browser session that "logs in" to a remote site. (For example: ...
2
1917
by: sbettadpur | last post by:
Hi everybody, Hi iam strugling with more than one submit buttons with in one form here is my code <form method="post" action="Offer.php" name='issueFrm' onSubmit="return fullOfferfields();">...
70
1059
by: quickcur | last post by:
hi can anyone explain me to read image to memory from a url it is very easy in java but it is hard to find an complete solution in c/c++. Thanks,
0
7046
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5342
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.