|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-01-23 19:18 UTC] iliaa@php.net
[2003-01-24 02:28 UTC] steveh at brendata dot co dot uk
[2003-01-24 03:16 UTC] steveh at brendata dot co dot uk
[2003-01-24 10:07 UTC] iliaa@php.net
[2003-02-07 23:47 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 10:00:02 2025 UTC |
When running the following code php core dumps. <? // Read the draper txt file $fp=fopen("draper.txt","r"); $good=fopen("draper_good.txt","w"); $bad=fopen("draper_bad.txt","w"); while(!feof($fp)) { $fields=split(",",fgets($fp)); $url="http://www.drapertools.com/draper/images/details/".trim($fields[1])."_".trim($fields[2]).".jpg"; $outfile="draper_images/draper_".trim($fields[1])."_".trim($fields[2]).".jpg"; print("opening $url\n"); ob_flush(); if($urlfp=fopen($url,"rb")) { print("Outputing to $outfile\n"); if($imagefp=fopen($outfile,"wb")) { print($url." -> ".$outfile."\n"); ob_flush(); fputs($good,$url." -> ".$outfile."\n"); $size=0; while(!feof($urlfp)) { $block=fread($urlfp,4096); fputs($imagefp,$block); $size+=4096; print($url." -> ".$outfile." : $size\n"); }; fclose($imagefp); }; fclose($urlfp); } else { fputs($bad,$url."\n"); }; }; fclose($fp); fclose($good); fclose($bad); ?> The input file is a comma delimited list, we are interested in the filename which we then retrieve from the site (you can find the names by going to the site or by downloading the text file from the site). Just recompiled with debug, here is the backtrace: #0 0x08153650 in php_hostconnect (host=0x82ef62c "www.drapertools.com", port=80, socktype=1, timeout=0x0) at /usr/src/php-4.3.0/main/network.c:435 #1 0x08153900 in _php_stream_sock_open_host (host=0x82ef62c "www.drapertools.com", port=80, socktype=1, timeout=0x0, persistent_id=0x0) at /usr/src/php-4.3.0/main/network.c:619 #2 0x0811a497 in php_stream_url_wrap_http (wrapper=0x82491f0, path=0x82ed5c4 "http://www.drapertools.com/draper/images/details/002_770-SA.jpg", mode=0x82e97cc "rb", options=4, opened_path=0x0, context=0x0) at /usr/src/php-4.3.0/ext/standard/http_fopen_wrapper.c:121 #3 0x08152d2c in _php_stream_open_wrapper_ex (path=0x82ed5c4 "http://www.drapertools.com/draper/images/details/002_770-SA.jpg", mode=0x82e97cc "rb", options=12, opened_path=0x0, context=0x0) at /usr/src/php-4.3.0/main/streams.c:2378 #4 0x080e915a in php_if_fopen (ht=2, return_value=0x82ee5ac, this_ptr=0x0, return_value_used=1) at /usr/src/php-4.3.0/ext/standard/file.c:1094 #5 0x404f78f0 in zend_oe () from /usr/local/Zend/lib/ZendOptimizer.so #6 0x404f43a0 in zend_oe () from /usr/local/Zend/lib/ZendOptimizer.so #7 0x0816f14c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/php-4.3.0/Zend/zend.c:864 #8 0x08148909 in php_execute_script (primary_file=0xbffffb40) at /usr/src/php-4.3.0/main/main.c:1573 #9 0x08190f48 in main (argc=2, argv=0xbffffbe4) at /usr/src/php-4.3.0/sapi/cli/php_cli.c:746 #10 0x40342657 in __libc_start_main (main=0x81905c8 <main>, argc=2, ubp_av=0xbffffbe4, init=0x806fe60 <_init>, fini=0x8196790 <_fini>, rtld_fini=0x4000dcd4 <_dl_fini>, stack_end=0xbffffbdc) at ../sysdeps/generic/libc-start.c:129