PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi,
I need to download a page source code to server and save it in the html file. First, I've tried to validate that page in http://validator.w3.org/ and got the answer "500 Internal Server Error"... later I've tried to download source code with fopen() function and it returned "failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error". The syntax was correct because that code worked with other URLs. Then I've tried to use cURL. The code is:
The result was a source code of only six lines when real source code of that page is much bigger. I can see that code using browser's "view source code" function. The first thought was that they are preventing connections from other servers or something.. or can it be that curl_init() function cant understand the given link? maybe because of the question mark? As you can see the URL of that page is https://pirkimai.eviesiejipirkimai.lt/a ... .asp?B=PPO. And also I've tested this code with other URLs ant it worked just fine. Any ideas? I woud appreciate any help. Thanks!
ok, I've changed it to copy() and still get "failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error ". The only log file that has changed was "access log" with message: "78.158.***.*** - - [07/Apr/2010:10:06:04 +0300] "GET /index.php/mainc/download HTTP/1.1" 200 656 "-" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" " does it say anything?
and I also tried to validate that page (the source i need) and got the answer: "500 Internal Server Error". Maybe there are other tools that can download source code? Maybe some can emulate the browser? because I can get the source code via browser.