Help With Troubleshooting?
Posted: Tue Jun 28, 2005 9:35 am
I hope this isn't a bother, and forgive my kludgy code; I'm just starting out! I had a script that was working fine yesterday; now it doesn't. Here's the snippet that's broken:
I assume there's something wrong with the way I'm generating $pic_url -- it seems like it's trying to access http://upload.wikimedia.org/wikipedia/e ... tr-sq.jpg/, and that final "/" is tripping it up, but I have no idea where it might be coming from (echo $pic_url[0]; seems to show the proper location...), and therefore I'm not sure how to strip it out.
Can anyone help? Thanks!!
Code: Select all
$source_url = "e;http://en.wikipedia.org/wiki/Wikipedia:POTD/"e;.date("e;F_j%2C_Y"e;);
$source = @file_get_contents($source_url);
$bits = explode("e;<!-- start content -->"e;,$source);
//Locate the picture
$process_pic = preg_match('/<a href="e;\/wiki\/Image:(.*?<\/a>)/si',$bitsї1],$pic_chunk);
$process_pic = preg_match('/<img src=(.*?)\/>/si',$pic_chunkї0],$pic);
$process_pic = preg_match('/http:(.*?)\.jpg/si',$picї0],$pic_url);
//*** Test stuff ***
$break = "e;\n\n<br/><br/>"e;;
echo $pic_urlї0];
echo $break;
//This doesn't work --
echo('<img src="e;'.$pic_urlї0].'"e;/>');
echo $break;
//But this does --
echo('<img src="e;http://upload.wikimedia.org/wikipedia/en/c/c2/Nat-gall-lond-tr-sq.jpg"e;/>');
//This comes up empty --
if (!$handle = fopen($pic_urlї0], 'b')) {
echo "e;Cannot open file!"e;;
echo "e;\n\n"e;;
} else {
echo "e;Thar she blows!"e;;
fclose($handle);
}
//But this catches the image --
if (!$handle = fopen('http://upload.wikimedia.org/wikipedia/en/c/c2/Nat-gall-lond-tr-sq.jpg', 'b')) {
echo "e;Cannot open file!"e;;
echo $break;
} else {
echo "e;Thar she blows!"e;;
fclose($handle);
}Can anyone help? Thanks!!