Just got the setup running. I can effectively run simple scripts like "hello world" et. al., however the other more complicated ones using fopen() and http fetching are giving me serious headaches. Here are some example scripts I tried to pretty much copy and paste into dreamweaver, then modify to fit my needs.
<?php
$returned=URLopen("http://www.yahoo.com");
function URLopen($url)
{
// Fake the browser type
ini_set('user_agent','MSIE 4.0b2;');
$dh = fopen("$url",'r');
$result = fread($dh,8192);
return $result;
}
?>
<html>
<?php
$rawurl = "http://www.economist.com";
$fp = fopen($rawurl, 'r');
// Prior to PHP 4.3.0 use $http_response_header
// instead of stream_get_meta_data()
$meta_data = stream_get_meta_data($fp);
print_r($meta_data);
foreach($meta_data['wrapper_data'] as $response) {
/ Were we redirected? /
if (substr(strtolower($response), 0, 18) == 'content-location: ') {
/ update $rawurl with where we were redirected to /
$rawurl = substr($response, 18);
}
}
?>
</html>
<?php
$pageContents = fopen("http://www.mauinews.com/default.aspx", 'r');
echo $pageContents;
?>
Only one of them worked, and then I changed some detail and it stopped. Otherwise, when I save the page in Dreamweaver after making changes, then reload the page in Firefox and/or IE after clearing the cache, it will simply stop without anything happening, or run nonstop like the page is still loading. I did manage to successfully use phpinfo() to determine that the installation is correct, and the FAQ here didn't list anything that I thought might solve my problem. Anyone have any suggestions?