Hello
(my username used to be johnyboy but it wasn’t possible for me to log in with that anymore, so have created a new account…)
I’m using curl to access programme pages on BBC’s site (to extract track listings) – have been doing this for a while and all’s been well. Now, I get an internal error on their site when using curl but not when using my browser. I don’t know if this is a programming/server set up mistake on their part or if it’s a slightly surreptitious way of blocking curl requests.
I’m wondering if anyone with curl installed in their php set up could run this code to see if it gives the same or different result as I get please? I’m trying to find out if it’s something to do with my server.
[code]<?php
function http_get($target, $ref) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $target);
curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt ($ch, CURLOPT_HTTPGET, TRUE);
curl_setopt ($ch, CURLOPT_POST, FALSE);
$return_array['FILE'] = curl_exec($ch);
$return_array['STATUS'] = curl_getinfo($ch);
$return_array['ERROR'] = curl_error($ch);
curl_close($ch);
return $return_array;
}
$target = ‘http://www.bbc.co.uk/programmes/b04kzqlf’;
$ref = ‘’;
$results = http_get($target, $ref);
echo ‘’;
print_r($results);
echo ‘’;
?>[/code]
I now get:
Array
(
[FILE] => <!DOCTYPE html> <html lang="en-GB" > <head> <!-- Barlesque 2.75.0 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <title> BBC - Programmes - Internal server error</title> <meta nam …….
in particular the “Internal server error” in the title. So I’m wanting to find out if that’s just me (my server) or not.
Thanks.