fopen

Counter won't work when I move it to another server

I set up a hitcounter so that each time someone goes to my site, one of 7 different sidebars loads up. There is a file called counter.php that writes to a text file called hitcounter.txt. All the references to files seem to be relative but when I moved them to a new directory at my new host I got this error instead of a happy hit count...

cant get php to save filename with correct name

For some reason, when using this code the file it outputs is just called ".jpg". <? $title = $GET['title']; $url = $GET['url']; $ourFileName = $title.jpg; $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); fclose($ourFileHandle); $ch = curl_init ("http://www.address.com/url=$url"); curl_setopt($ch, CURLOPT_HEADER, 0)...

PHP - Get page from external server.

I want to pass a function a string, which takes that string tacks it onto url. Then goes to that url and then returns the page to my server so I can manipulate it with JS. Any Ideas would be much appreciated. cheers. ...

RTF Library - PHPrtf Has anyone used it?

For some reason, my line breaks in my test.txt file are not being preserved. $sect->writeText(file_get_contents("test.txt"), $times12, $null); Has anyone played around with this library? http://sourceforge.net/projects/phprtf/ My question is: How can I preserve my line breaks from my test.txt file? What is happening is the docum...

iPhone - fopen and pathForResource - Permission denied

I've tried to open a file directly like fopen("/test.txt","w+"); it works on the simulator but doesn't work on the iPhone. Then I've tried this: NSString *path = [[NSBundle mainBundle] pathForResource: @"GirlName.txt" ofType:nil]; NSLog(path); fichier = fopen([path cStringUsingEncoding:1],"w+"); if (fichier != NULL) { ... } else {...

How to output the reason for a PHP file open failure

I'm trying to debug a huge, antiquated (circa 2001) PHP web service and I'm encountering file open failures. The fopen call is in an included module, the caller is logging that the file could not be opened but no reason is being logged. The code that actually does the open is: // Read the file if (!($fp = @fopen($fileName, 'rb')))...

daily image download

I'm looking for a solution to automate downloading of charts from stockcharts.com. If you click on the following URLs, stockcharts will automatically generate an image file (sc.png). Note the only different is the stock ticker symbol at the end. I would like to download these charts daily to folder on my computer. http://stockcharts....

Can someone explain the limitations of cron job scripts to me?

I think I'm confused about exactly what the difference is between running a PHP script as a cron job versus accessing it with a browser. When I test test.php by hitting it with Safari, it writes to a text file as expected, makes DB entries, etc. When it runs as a cron job, it does everything except write to a text file. I already dealt ...

Browser crashes when about around 4 million records entered in MYSQL.

hello all I downloaded a database that was exported to the TXT format and has about 700MB with 7 million records (1 per line). I made a script to import the data to a mysql database, but when about 4 million records inserted into, the browser crashes. I have tested in Firefox and IE. Can someone give me an opinion and some advice about ...

How can I tell what line a file resource is currently "on" in PHP?

Using PHP, it's possible to read off the contents of a file using fopen and fgets. Each time fgets is called, it returns the next line in the file. How does fgets know what line to read? In other words, how does it know that it last read line 5, so it should return the contents of line 6 this time? Is there a way for me to access tha...

Problem with hex literal in string comparison

I'm reading in an NES ROM file, where the first four bytes are "\x4e\x45\x53\x1a", or NES\x1a. In my actual code, the given file can be arbitrary, so I want to check to make sure this header is here. However, I'm running into some trouble, which the following code demonstrates: #include <stdio.h> #include <string.h> int main() { FILE ...

Does fopen have a size limitation?

I'm having problems using fopen in php. If I open the desired URL by hand I get: OK,13:24:34.236 INFO [10] org.mortbay.http.SocketListener - Started SocketListener on 0.0.0.0:4443 13:24:34.236 INFO [10] org.mortbay.util.Container - Started org.mortbay.jetty.Server@52fe85 13:24:39.251 INFO [11] org.mortbay.util.Credential - Checking Res...

PHP: Emailing HTML Body of PHP Template file

I'm currently using PHP's mail() function to email the HTML Body of another PHP file using concatenation. This is currently working fine, however, I would prefer the script to simply get the parsed HTML Body rather than using the concatenation method. I've read a few incomplete forum posts regarding using fopen() and fread() but had no...

fclose() causing segmentation fault

I have a tab-delimited text file that I am parsing. Its first column contains strings of the format chrX, where X denotes a set of strings, e.g., "1", "2", ..., "X", "Y". These are each stored in a char* called chromosome, as the file is parsed. The text file is sorted on the first column lexicographically, i.e., I will have a number...

Is there a way to use fopen_s() with GCC or at least create a #define about it?

Hi, MSVC compiler says that fopen() is deprecated and recommends the use of fopen_s()... Is there any way to use fopen_s() and still be portable? Any ideas for a #define? Thanks. ...

PHP Form writing to file in https://

Hiya I'm having issues getting a php form to write to a file hosted with the apache httpsdocs folder. The form works just fine if all parts of it are using the http protocol, but when I secure the form, form submission and the file the results are written to, it fails. Can anyone help? This is the php code: $myFile = "files/data.txt...

Retrieve partial web page

Is there any way of limiting the amount of data CURL will fetch? I'm screen scraping data off a page that is 50kb, however the data I require is in the top 1/4 of the page so I really only need to retrieve the first 10kb of the page. I'm asking because there is a lot of data I need to monitor which results in me transferring close to...

Opening file in another directory in C

How is this achieved? I want to use pFile = fopen( file, "rb" ); Where file is a char, string or long containing the literal text containing a local path to a binary file C:\Documents and Settings\Supernovah\Desktop\Supernovah.bin but of course that crashes. I am also interested in how to recur over the current directory in a port...

C fopen vs open

Is there any reason (other than syntactic ones) that you'd want to use FILE *fdopen(int fd, const char *mode); or FILE *fopen(const char *path, const char *mode); instead of int open(const char *pathname, int flags, mode_t mode); when using C in a Linux environment? ...

php fopen disabled - alternative needed

My web host just disabled fopen() My script used to open and write to a text file on the server, but no longer can. Is there an alternative function to fopen? ...