Getting a file via CURL Posting Data?

You are never writing to the file You need to write the result to file fwrite($fp, $result) You are probably better off using file_put_contents then you don't need to open/close the file php.net/manual/en/function.file-put-cont... if ($file_put_contents('download.txt. Gz', curl_exec($ch)) === false) { // Handle unable to write to file error. } But maybe using the $result in between to check the request was actually ok before saving it to file You should check the return from curl_exec() $result = curl_exec($ch); if ($result === false) { echo 'Curl error: ' .

Curl_error($ch); } Writing false to a file would result in an empty file, so this could be whats happening.

You are never writing to the file. You need to write the result to file. Fwrite($fp, $result); You are probably better off using file_put_contents, then you don't need to open/close the file.

php.net/manual/en/function.file-put-cont... if ($file_put_contents('download.txt. Gz', curl_exec($ch)) === false) { // Handle unable to write to file error. } But maybe using the $result in between to check the request was actually ok before saving it to file.

You should check the return from curl_exec() $result = curl_exec($ch); if ($result === false) { echo 'Curl error: ' . Curl_error($ch); } Writing false to a file would result in an empty file, so this could be whats happening.

Hmm; I switched a few things out; not getting a fail however it's still leaving me with a 0 kb file. – Frederico Feb 22 at 5:06 expanded answer, check the return of curl_exec doesn't equal false. – Jacob Feb 22 at 5:14 @Jacob: Thank you for your help; sadly by adding that; nothing still shows up as an error; and i'm still getting a 0kb file.

I'm not sure why though. – Frederico Feb 22 at 5:24 Have you tried doing it manually through the browser? Create a form that posts the same values and see what it returned?

– Jacob Feb 22 at 5:34 Yes. There are two parts, an initial login, and once I'm logged in I request these params, and it prompts file for me to start downloading. – Frederico Feb 22 at 6:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions