Basically, I want to grab an image from http://188.8.131.52/jpg/image.jpg and write it to a directory. Simple enough.
I looked at the info at http://wiki.dreamhost.com/index.php/CURL_PHP_tutorial, which proved to be worthless to me.
When I put the following code into a page and run it, I get a new file called “example_htmlpage.html” written in my directory. Cool.<?php $ch = curl_init("http://rss.news.yahoo.com/rss/oddlyenough"); $fp = fopen("example_htmlpage.html", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?>
I made a couple of changes to attempt to fetch an image from http://184.108.40.206/jpg/image.jpg, and sure enough it didn’t work.
I’m very new to the CURL stuff (but not new to PHP), so I’m sure it’s user error. I’d much rather use fopen(), fwrite(), etc…
Does anyone have a simple code solution (that will work on DreamHost) where I can fetch a JPG image from my own AXIS 207w webcam in my apartment and save the image (called image.jpg) in a directory on my web site?
Thanks in advance for any helpful input.