473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP and WGET generate 0 byte files

I have a problem with PHP where wget generates 0 byte files. Below
is
the code that I use.

// *************** *****
$savedir = "/webroot/vifs/app/webroot/static/1234567890";
$url = "http://www.google.com" ;
$test = mkdir( $savedir, 0777);
exec("/usr/bin/wget -nH -nd -d -P$savedir $url");
// *************** *****
What I have noticed is that if the directory already exists, WGET
works fine. But if the directory is created prior to, as shown in
the
code, WGET generates a file of 0 bytes.
MKDIR always returns successfully.
I've tried inserting a SLEEP(5) after MKDIR and that does not help.
Would anyone know why this is happening?
Thanks

Nov 7 '07 #1
2 3560
On Nov 7, 3:12 pm, Don69 <vaillancourt.. ..@gmail.comwro te:
I have a problem with PHP where wget generates 0 byte files. Below
is
the code that I use.

// *************** *****
$savedir = "/webroot/vifs/app/webroot/static/1234567890";
$url = "http://www.google.com" ;

$test = mkdir( $savedir, 0777);

exec("/usr/bin/wget -nH -nd -d -P$savedir $url");
// *************** *****

What I have noticed is that if the directory already exists, WGET
works fine. But if the directory is created prior to, as shown in
the
code, WGET generates a file of 0 bytes.

MKDIR always returns successfully.

I've tried inserting a SLEEP(5) after MKDIR and that does not help.

Would anyone know why this is happening?

Is safe mode on? I once had a problem with PHP not writing to a
directory that had been chmoded 0777. Turned out the problem was safe
mode. I turned it off and then things worked fine.

However, that is a long shot. My first guess is that this is more of a
wget issue than a PHP issue.


Nov 8 '07 #2
On Nov 8, 3:12 am, Don69 <vaillancourt.. ..@gmail.comwro te:
I have a problem with PHP where wget generates 0 byte files. Below
is
the code that I use.

// *************** *****
$savedir = "/webroot/vifs/app/webroot/static/1234567890";
$url = "http://www.google.com" ;

$test = mkdir( $savedir, 0777);

exec("/usr/bin/wget -nH -nd -d -P$savedir $url");
// *************** *****

What I have noticed is that if the directory already exists, WGET
works fine. But if the directory is created prior to, as shown in
the
code, WGET generates a file of 0 bytes.

MKDIR always returns successfully.

I've tried inserting a SLEEP(5) after MKDIR and that does not help.

Would anyone know why this is happening?

Thanks
-P$savedir =-P $savedir

Nov 8 '07 #3

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

Similar topics

3
8175
by: Martin | last post by:
I have a PHP script that should be run a few times a day. Currently I run this script manually as I haven't been able to set up Lynx or wget to run it as a cronjob. Or to be more specific: the script works, but both wget and Lynx fail after 10 or 20 redirects, then it warns: wget: 20 redirections exceeded. Lynx: Alert!: Redirection limit of 10 URL's reached. What the scripts does is download various HTML pages (allowed by the owners)...
1
4011
by: LRW | last post by:
In a PHP script I have the following two lines: $thumbproc = escapeshellcmd("wget -q -T 2000 http://(A URL)/pa-thumbs/createthumbs.php?dir=".$order_po." &"); exec("$thumbproc 2>&1", $output); Works perfectly...except, it always waits until it finished with the wget before it continues in the script. Normally this wouldn't be a problem, except this wget is calling a page that's doing some image manipulation that can take up to two
7
7723
by: Ken | last post by:
How do I call c:\wget\wget.exe from a php or html file? so I can use php variables to define the file names to download. I want to set up wget to download several files from a server to my hard drive so they can be used internally. Ken
2
1948
by: Robert P. J. Day | last post by:
just getting started with python, and i'm designing a program for fetching software from the net, given the package name, version number and/or date stamp, download method (tarball, CVS, etc.) and so on. i've already got a shell script doing this, but python would certainly clean up the code a lot. first question -- does such a utility/module (or something like it) already exist? that is, with the ability to say, "go get me gcc,...
2
4776
by: Google Mike | last post by:
I have an RH9 Linux PHP 4.2.2 web page that I need to call a Bash file under the context of root and do the wget command to download a file, clobbering the previous download of this same filename. It's bombing without leaving any trace. I tried introducing all manner of chmod, chown, sudo, and sticky bit, but this fails. The only thing I see in the syslog is failed sudo authenticaiton for user Apache. What's the technique to get this...
4
2082
by: Stephen | last post by:
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather than creating a file. I assume I should be using System.IO.MemoryStream but can't get this to work. ' XML will be serialized to file.xml, in UTF-8, with BOM. Dim tw As New System.Xml.XmlTextWriter( _ New System.IO.FileStream("file.xml",...
7
9496
by: petr pilsl | last post by:
sorry - no idea where to post my question, so I crossposted to a linux and a html-authoring-group. Both groups might be familiar with wget. wget -p http://www.goldfisch.at does not load the images embedded in this website. I wonder why? according to the man-page : -p
0
3141
by: David Hauser | last post by:
Hi all I have a aspx page that should generate a zip file from a couple of files. I tried the following code, but something doesn't work correctly, although no error message appears and the dialog box for downloading the zip file appears. But when i try to open the zip file the zip application return an error like "file is corrupted or not a zip file". Has someone a hint for me what's wrong with my code? Or knows somebody a good tutorial...
3
7853
by: Jesse | last post by:
Hi all, I have a problem using wget and Popen. I hope someone can help. -- Problem -- I want to use the command: wget -nv -O "dir/cpan.txt" "http://search.cpan.org" and capture all it's stdout+stderr. (Note that option -O requires 'dir' to be existing before wget is executed) Popen doesn't work, while os.system and shell do. Popen will give the error:
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.