Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Anyone Know How To Create Automatic Download Using CURL And Creating A New Folder Every Day???


I want to save a zip file daily. The file is named the same thing
each day so I would like to create a folder and name it with today's
date and then save the zip file into that folder.

I'm using this code and can't seem to figure out how to create the new
folder and save the file there.
Any help is appreciated!

$todays_date = date("Ymd");

$fp = fopen (dirname(__FILE__) . '/file.zip', 'w+');//This is the file
where we save the information
$ch = curl_init('http://www.downloadhere.com/file.zip');//Here is the
file we are downloading
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);

So each day I should have something like 20070807file.zip.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Automatic Download
I guess this is done with headers.. You know those download pages: you click "download" and it leads to next page with message: "click here if your download doesn't start automatically". How can i do it? How can i show a next webpage and force download at the same time? Can it be done using PHP? I think it's something to do with headers..

Automatic Download On The Client?
I'm writing a download manager in PHP for a series of mp3 files. At the moment, the users have to right click a link to the mp3 file and "save as" to get it onto their hard drive.

How can I make the files download automatically when they click a link or press a form button? I've seen this work on other download sites..

Automatic Download Of Files Using Application/save On Windows XP SP2 Browsers
For the past two years, we have offered files for download through a
secure website. Users, after clicking on a link, are redirected to a
PHP page that passes the appropriate header information to the user
and inquires if that user wishes to download the file.

A sample of that code is below:

header('Content-Type: application/save');
header('Content-Disposition:attachment; filename="'.$file_path .'"');
header('Content-Transfer-Encoding: binary');
header('Content-length: ' . filesize($full_file_path));
readfile($full_file_path);

However, with the enhanced security now available in Windows XP SP2,
users are no longer prompted to download the file. In fact, Windows
XP SP2 not only suppresses the download but will not even present the
end user with an option to download the file. Has anyone else
encountered this type of situation? If so, is there a programmtic
solution to, at the very least, prompt the user to download the file
without requiring the user include the website as one of his/her
trusted websites.

What Function To Use To Create A Folder ?
What function to use to create a folder ?

Creating A Folder And Page
im is create a php script which when you register (registrationlogin script already made) it will create a folder where it gets the name from the username field and password the folder with the password from the password field it will then create a page in the folder called index.php (i can make the page i just need help with the script to make the folder and page).

Creating A Folder Index With Link
I'm trying to think of ways to create a folder index for a client.
Basically they want to upload PDF's to a folder and have the PHP
script index the folder for a file list with links to the files to be
displayed in a browser. No navigation to other folders. Just a list
of a specific folder with links to the files. This can be done with
simple html and frames but they do not like the look and want more
formating control. Any thoughts. I've seen some file manager scripts
but that is more function than I need.

Creating / Removing A Remote Folder
I thought there had to be an easy way to do file functions relating to folders, eg: create/modify/delete. Is there? Or am I in for some sort of craziness?

Download-scriptto DL Files Outside The Public_html Folder
I have a small Linux webserver, and want to find a (php) script
that lets my users download files located outside of the public_html
folder.

Create A Folder In A Directory One Level Up On A Linux
I am trying to create a folder in a directory one level up on a Linux
based Apache server from the file containing the following line.


The followin line doesn't seem to achieve this.

mkdir("./members_pics/"."$subscr_id"."/", 0700);

Php Form To Create A Folder On Linux Server
Is there a simplier way rather than via the Networking tutorial example "shh with php"...? Would I still need to create the priv and pub keys? This is a form creating a folder, both on the same server btw.

Creating Predefined Folders In A Bunch Of Folder
This can of course be solved with other things than php, but since I write php myself I was looking for a solution using it.

The problem is:I have folders set up like this /letter/id/ (ie. /g/132/)

What I would like to do is run a one-time operation that creates a totalt of four predefined folders in each /id/ ...
The script would have to go through all letters (ranging from a-z) and make these folders in each /id/.

PHP5, Win2003, Create Any File Or Folder On The Server
If I create any file or folder on the server and run the php file it
works with no problem. As soon as I copy a website from another
server onto this one none of the php code works and the browser only
shows the actual php code.
Is there a permission I need to set? I have never had this problem...

Image File Download Using CURL
I need to copy an image file (e.g. a ,jpg) from an http: address to my
web server using PHP. I have been trying to get CURL to work, but for
reasons that aren't clear to me, I can't get it to work properly.

The code I'm trying to use is ($source and $dest are passed in):

$ch = curl_init(rawurlencode($source));
$fp = fopen($dest, "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

curl_exec($ch);

$isok = true;
$errno = curl_errno($ch);
if ($errno != 0)
{
echo "CURL: ".$errno;
$isok = false;
}

curl_close($ch);
fclose($fp);

I keep getting error 28 (timeout). But if I put the web address of
$source right into my browser, up pops the image (instantly).

Does anybody a) see anything wrong with the above, and/or b) know of
another alternative to CURL to get the job done?

Creating Download Link For A Pdf
Using:
Mysql 5.0.15
php 5.1.6
apache 2.2.3

I am trying to create a download link for various pdfs which I have stored in a
mysql DB.

I am having trouble with the header fields when clicking the link.

Here is the code that sends the pdf called using
<a href="download.php?id=4">Blah</a>

Output is delayed from php.ini (output_buffering = 4096)

What http headers should I be sending.

This works most of the time like this, but in IE6 I get few strange results
sometimes.

1. Clicking on a new page after downloading the pdf - the page is blank unless I
refresh
2. The URL in the address bar does not update even though the page does.
3. If I leave out the Content_Disposition header and set the Content-Type:
application/pdf. The browser just displays the PDF as text.

<?php
include($_SERVER["DOCUMENT_ROOT"] . "/../php/common.inc");
include($_SERVER["DOCUMENT_ROOT"] . "/../php/prepend.php");

$db=new Interlex_DB;

if(isset($_GET["id"]))
{
$query=sprintf("SELECT pdf, filename, length(pdf) AS len FROM broadsheets
WHERE broadsheet_id='%d' AND active=1", $_GET["id"]);
$db->query($query);
if($db->next_record())
{
if(!headers_sent())
{
header("Accept-Ranges: bytes");
header("Content-Transfer-Encoding: Binary");
header("Content-Type: application/force-download");
header(sprintf("Content-Length: %d", $db->f("len")));
header(sprintf("Content-Disposition: inline; filename="%s"",
$db->f(filename)));
echo $db->f("pdf");
//exit;
}
}
}
?>

Launching Several CURL Posts Without Waiting To Download Pages..
Hy there, ok, i`ll get to the problem:

My php script has a function named curl(some curl options and instructions), it doesn`t matter that, what it matters:

$var1 = curl("http://www.somedomain.com/somepage1.php");
$var2 = curl("http://www.somedomain.com/somepage2.php");
$var3 = curl("http://www.somedomain.com/somepage3.php");
$var4 = curl("http://www.somedomain.com/somepage4.php");

Ok, so it downloades the content of somepage_.php to the $vars, however somepage_s_.php contains several scripts which takes a verry long time for the page to download, so my script waits for each page to download, one by one, as line by line, what i would like do rezolve is to start the curl without waiting to download the first page, then the second and so on, it should start the download of all the pages at almoust the same time. That would be all, please help, i`ve lost 4 nights trying to get this fixed but no luck.

Curl - Resume Http Download - Apache Log Files. Gz
I am writing a Php script to run on my home PC (Windows) that downloads an Apache access log file and inserts new entries into a database.. The only way I can access these log files is through a cPanel URL that delivers a gzipped copy of the log file with all entires for the current month (up to the current date and time).

I want to run this script once a day (at night) and would like to download the gzipped file by resuming from where I left off the day before (instead of always downloading the entire gzipped file).

I have tried using CURL with the option - curl_setopt($ch, CURLOPT_RESUME_FROM, $prev_offset) - but that always restarts the download from the beginning. ($prev_offset is the previous days file size).

I'm not sure what the structure of a gzip file is, so I don't even know if it is possible to resume a gzip file download when the file has been rebuilt in the mean time (cPanel creates a gzipped file with the same name from the raw log files every time you access that page in cPanel). My guess is that this is probably not possible. ... But .... I am trying to make the resume work to find out for myself and I can not make
the resume work.

The bottom line is that I am trying to avoid downloading the entire gzipped log file every time I need to download it.

As an alternate, I have been successful using gzopen, and then I can gzseek to the previous offset, but I am unable to use a secure URL (https) with the Zlib functions (gzopen) with my Windows version of Php (the username and password have to be included in the cPanel URL to access the log file, so I'd like to use SSL.)

(I have started another thread to figure out how to get a Php Windows binary with https and ftps as registered streams (built with --with-openssl in the ./configure command), but so far I have gotten no replies).

Question: When using gzread, where does the decompression take place - on the server where the file is located, or on my PC after the compressed data is downloaded? Does gzseek work on a compressed file, or must it be uncompressed on the server first? The point being; when I use gzopen and gzread, am I downloading compressed or uncompressed data from the server where the log files are located?

I can use either method, but want to meet two requirements.

1. I do not want to download redundant (old) data every day (I want to resume where I left off) ... and ...

2. I want to send the request for the log file (containing a username and password) using SSL.

Need To Create And Make Download Link For Csv
i have an app that i need to be able to publish a link to download a
csv file.
i know that i can use php to make the file, but how to i link to it
through php.
like if i have an html file that has a link in it like this
<a href="somedata.csv">here be data</a>
or would i make that a .php file that would generate a csv ?

the data will come from MySQL.

Best Way Creating Midi Upload/download
What will be the best way to design a php midi upload/download page? Oh, that will be in text files. I want something where users can upload midi's to my server and then it must put midi files according to artist, song name, etc in sub directories and then user must be able to download the midis, or search for a specific midi by artist, song name, etc.

Creating Download Manager For Multiple Files
Has anyone run across some sort of download manager to be able to download multiple files at a time via http with PHP? I run a mp3 site and I would like to be able to allow people to download whole folders at a time basically the same functionality as ftp but with http. It would be kind of like the smart download thing that netscape has but cross platform compatible. Any ideas?

Creating Black Images When Trying To Create Thumbnails
I am trying to create thumbnails. However, I
am only creating black image with the correct thumbnail size. I am
using php 5.1.6 and GD 2.0.28. Below is the code that I am using.

function createThumbnail($imageDirectory, $imageName, $thumbDirectory,
$thumbWidth)
{
$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);

$thumbHeight =200;
$thumbWidth =100;

if($origWidth $origHeight && $thumbHeight < $origHeight){
$thumbHeight = $origHeight / ($origWidth / $thumbWidth);
} else if ($origWidth < $origHeight && $thumbWidth < $origWidth)
{
$thumbWidth = $origWidth / ($origHeight / $thumbHeight);
} else {
$thumbWidth = $origWidth;
$thumbHeight = $origHeight;
}
$thumbImg = imagecreatetruecolor($thumbWidth, $thumbHeight);

imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $thumbWidth,
$thumbHeight, origWidth, $origHeight);

imagejpeg($thumbImg, "$thumbDirectory/$imageName");
}

if(!file_exists("/home/alanna/public_html/pics/thumb/")){
if(!mkdir("/home/alanna/public_html/pics/thumb/")){
echo "error making thumbs directory";
}
}

if(file_exists("/home/alanna/public_html/pics/thumb/". $imagename)){
echo "File already exists";
}
else
{

createThumbnail("/home/alanna/public_html/pics/full/", $imagename, "/
home/alanna/public_html/pics/thumb/", 100);

}

Creating Link To File Or Temp File For User Download
I am designing a document management system (DMS). The files are stored
in a directory on the webserver. The filenames for the documents are
stored in a MySQL database. The DMS will track revisions from the
initial version through the updates. We must have strict permissions
set so only authorized personnel can access some documents. All of the
documents when uploaded are given totally random names such as
"114723fb5422c6bd5ed18f6.doc". Is there a way, without the webserver
creating a new file name "document_specs_ver2.doc" to have the file
download named "document_specs_ver2.doc".

If I must physically create a new file, how do I know when the
webserver would be allowed to delete it? Notes: The files will be in
several different file formats, not just "doc".

Drag Files From One Folder To Another Folder (copy) .. Possible?
Is it possible to write codings PHP or Javascript.. GUI representation
of File handling (ie. Drag files from one folder to another folder (copy)
like our windows).. pls give me some reference codings like this..

Remove From $name (folder)/(folder)/[x]/ <-- If Exists To Just Get [x].
I'll be quite honest. I don't have the faintest idea
how to do this, while I can do other php without a problem. Once I
know how to go about it I'll be okay.
It's two things I think?
1. see if there's a trailing slash and delete it.
2. Remove the preceding path to /x, the folders and slashes, and
delete them.
and then I have x.

X by the way is the final folder in a website and this grabs it for
me.

<?
$name = $REQUEST_URI;
?>

CURL Problem.. Comparing Output From IE/CURL Differs
I'm writing a tiny php app that will log into our bank of america
account and retrieve a file containing a list of checks that cleared
the previous day. The problem I'm running into is when I perform
actions with php/CURL the output is different than when I use IE and
I'm completely stumped as to why. The final output should list files
available for retrieval but the CURL output displays an error/empty
file message.

Here is the curl portion of my code:

Post Form With Field Containing "curl Curl"
I have a form that posts and 1 field is for a suburb, 1 of the suburbs in our area is "curl curl".

When ever this is entered we get an error message "You don't have permission to access".

Automatic Mail
I am a newbie and I'm writing a application as a feedback database. The user submits his name e-mail etc. into a form and thenit stores it. I want to be able to send a sort of thank-you message after they fill in the form. How could I do that?

Automatic Backup Of SQL
I'ved maked a bacup sistem that saves a specific databases in a dir/ BACKUP .. on submiting a button from a form.

Now I want to make it automatic ... the specific file when is written saves the date and time is saved . PHP Code:

Automatic Submit
When you click a drop down box to display, then select the option from the drop down box after that, how do you make it submit automatically without pressing "go" or "submit" button? Can I do that in PHP?

Automatic Include
I want to automatically include one php file in all my webpages. This is for tracking purpose and must be included before any header information is sent.

The problem is I have 1200 pages and it would be not efficient to edit and put the "include" command in every webpage. Is there a way to do an inculde from a server end before a php file is called?

Automatic Mailing
I have a database in which people can submit theirselves. As soon as they submit the database gets updated and they should get a mail with their login-name & password. Does anybody know if this is possible to programm with php?

Automatic Redirection
can someone give me a sample code for automatic redirection ? Like after a certain period of time (say 5 seconds) the page will automatically be directed to a new page.

Automatic Links
what is an easy way to parse a string that is being outputted along with html onto a browser in order to find all URLS and email addresses, and then automatically formatting them so that they are linked to either that url or email address? Basically, I would like to send a string like this:

Hello, my email is estrabd@yahoo.com and my homepage is http://www.mysite.com

To a function that would return something like this:

Hello, my email is <a href="mailto:estrabd@yahoo.com">estrabd@yahoo.com</a> and my homepage is <a href="http://www.mysite.com">http://www.mysite.com</a>

Automatic Url Redirection
i'm trying to redirect the user back to the original page he came from after logging in. when a user enters a page that requires logging in, the page will automatically jump to the login page.

so what's the problem u might ask? in the situation below, admin.php loads the login page with the variable $login_referer which is the url of admin.php if the user is not logged in. now this is what i want to happen but...... PHP Code:

Automatic PHP Execution?
I have the following question,
I have an application which transfers a csv file (via FTP) to the server
then on the server I have a PHP script which put the content of the CSV into
a mysql
The question is now how can I start without manual interaction this PHP file
?

Automatic Email
I wanted to know is there a way I can send my users an email on their birthday automatically? What I mean is, I want a php script to be executed once everyday without having someone click the link to run the code.

Automatic Forwarding In PHP
I was wondering how I can get a php page to automatically forward to another page when a certain action is made. For example, a user logs in, I want the page to automatically forward to the main user page. Is is this possible?

Automatic Authentication Using Php
I have an internet radio station that uses shoutcast server. In the admin section there is a link to kick the stream. The problem is that I don't want to give out my password to all of my Dj's for obvious reasons. I was wondering if there is a way that I can use php to trigger the link using the login information without the user seeing it.

Normally when I click the admin link a box pops up asking for username and password.

the target of the kick source link looks like this
http://www.myserver.com:8000/admin.cgi?mode=kicksrc

the only other option I have is to give out the password and change it if a problem presents itself.

Automatic Install
I have seen on a lot of sites that when you click on a link, if the file you are opening has an associated program with it and it is not installed on your computer then it will first install the program and then open your file.

Automatic W3C Validation?
One of my many, many "started with enthusiasm, then quietly abandoned"
projects was to code some PHP which could be included into every page
on my site (blog included) and would verify the page (via the W3C
validator) each time that it was loaded and e-mail me if there were any
problems.

I "quietly abandoned" it when I realized that it was "kewel to kode"
but I don't really know why I wanted it, or how it would work.

On the face of it, I only need to validate each time I change a page.
So, validating with every load seemed ridiculous; which lead me to a
flat file database where I could check the page file's last update date
against its last verification date, thus avoiding unnecessary
validation.

Then it occurred to me that with so many includes (standard header &
footer, etc for menu, hit count, etc), the web page's main file could
be unchanged, but - if an included file were altered - then it might
no longer validate properly.

See my dilemma? So I have put this to one side (since there are plenty
more little projects to code) until I can specify it correctly.

Any comments/suggestions? Anyone know of something similar which
already exists?

Automatic IP Blocking From DB
i look for a code [maybe some 1 knows already] to automaticley block an IP address that it is located in the DB, to prevent users from accessing my site twice.
if some1 know already when i can get that code that i will be glad, also i have found that code:

$ip = $_SERVER['REMOTE_ADDR'];

if($ip == "123.123.123.123" || $ip == "213.213.213.213") {
  // YOUR BANNED
} else {
  // YOUR NOT BANNED}

but it is not automatic and not from DB.

Automatic Position?
I have a basic table/database set up to record a persons name, location, the number of miles travelled and their position in a race.

At the moment all of these fields have to be entred manually when you wish to update them.

Is there a way to automatically assign a position? (i.e. the person who has travelled the most number of miles 1st - least nth?

Automatic Timed Redirection
I'd like to know if there is a way in (PHP) in which you can redirect somone to a certain page as soon a couple of words have loaded on a page.. ex.( 'blahlballblblbl' and at the same time it will redirect to that 'certain' site.

Automatic Date Entry
Im doing a new submission script, through a form, and ive got a field in the database called date_submitted. I was wondering whether to use timestamp or datetime field.
And how do you do a query to put the current date in.
So basically i want the date that the article was submitted automatically put into the database as this is a basis of a query for another part of my site.

Automatic Completion Of Forms
I have a question I hope that someone can help me with. I have a form where I have a drop down box for 'staff levels of pay' and I want my form to automatically complete the remaining sections of the form once the person completing the form selects a certain pay level. EG. Select level 1 on the drop down and then in other fields such as 'pay level' 'description' - the information is automatically displayed in the fields after selection made. Does anyone know where I may also find a website with code that may provide me an example of how to do this. Do I need to checkout PHP stuff or is this done in SQL code. Finally how do I get the information into the database.

Automatic Subdomain Creation
As the title suggests I am looking for a push in the right direction when it comes to a script that can autmatically generate subdomains.

I was wondering about if it was possible with php (if not then is there a scripting language that could do it?)

What are the security implications for it? Can it be made secure?

Are there any limitations on the type of server this could be done on?

Automatic Links For Key Words
I have a site with a large number of pages, and want to use PHP to automatically cross-link them using key words.

For example, whenever the word 'contact' appears, I want it to automatically link to the 'contact' page.

Because there are 100+ different pages, I don't want to have to edit the links manually.

Does PHP Do Automatic Garbage Collection?
Does PHP do automatic garbage collection, or should you explicitly
destroy things.

I found this statement mysql_free_result($result);

Automatic Form Submit
I have to develop an application sounds like this:-
User is allow to access a form (is actually a test/quiz) within a
specific time frame, let say 45 minutes. After this 45 minutes, if the
user has not yet click the submit button to submit the form, the
system need to automatically submit it.

So, can anyone teach me how to check the time out as well as how to
make the form submit automatically? Thank you very much.

Automatic Scheduled E-mails
I have a website that I am building in PHP that I would like to send e-mails
to users every 2 days to inform of new updates. I know how to trigger the
sending of e-mails if a user enters the site, and can limit this to only
happening once every 2 days, but I am interested to know if it is possible
to have PHP send e-mails automatically in case no one visits the site?


Copyright © 2005-08 www.BigResource.com, All rights reserved