curl-and-php
difficuylt website to reach and get content from
Date: Sat, 7 May 2005 11:01:14 +0200
I have the following problem:
When I try to get the content of www.vbo.nl <http://www.vbo.nl/> I get
error message after error message.
HTTP/1.1 302 Found Transfer-Encoding: chunked Server: Microsoft-IIS/5.0
Date: Sat, 07 May 2005 09:26:25 GMT X-Powered-By: ASP.NET X-AspNet-Version:
1.1.4322 Location: /error.aspx?aspxerrorpath=/Default.aspx Cache-Control:
private Content-Type: text/html; charset=utf-8 --------------: --- HTTP/1.1
500 Internal Server Error Transfer-Encoding: chunked Server:
Microsoft-IIS/5.0 Date: Sat, 07 May 2005 09:26:25 GMT X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322 Cache-Control: private Content-Type: text/html;
charset=utf-8 --------------: ----
When I try to get the content of www.alternate.nl <http://www.alternate.nl/>
I works fine.
When I let www.websiteoptimization.com/services/analyze/ analyse www.vbo.nl
<http://www.vbo.nl/> the can do it. So somewhere there is a solution.
What do I do wrong?
I use the following php code:
<?php
$ch = curl_init(); // create cURL handle (ch)
if (!$ch) {
die("Couldn't initialize a cURL handle");
}
// set some cURL options
$ret = curl_setopt($ch, CURLOPT_URL, "http://www.vbo.nl/");
$ret = curl_setopt($ch, CURLOPT_HEADER, 1);
$ret = curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$ret = curl_setopt($ch, CURLOPT_TIMEOUT, 130);
// execute
$ret = curl_exec($ch);
if (empty($ret)) {
// some kind of an error happened
die(curl_error($ch));
curl_close($ch); // close cURL handler
} else {
$info = curl_getinfo($ch);
curl_close($ch); // close cURL handler
}
?>
Received on 2005-05-07