I have a program that sends a mass email to everyone that is in a database. The mass email program has been working fine, but my clients site is being moved to a new server and now that they have moved to a new server one part fo the program doesnt work.
There are 2 options to the program.
Either the admin for the list can type the email in a textarea box or the admin can check a checkbox and then type in a url in a textbox, the program reads the html contents of the URL and sends it out to the list.
I have coded this part of the program in 2 different ways and neither one works. If I code it with curl it doesnt even seem to get the contents of the url and if I do it with fopen and fread it grabs the contents of the url on the old server, but hangs up on the new server. I have the browser timeout set to zero which is unlimited.
Here is the code with both ways of coding this part fo the program.
if (isset($_POST['checkbox'])){
$urlFile = $_POST['message2'];
$openUrl = fopen($urlFile, "r");
$message = "";
while (!feof($openUrl)) {
$message .= fread($openUrl, 8192);
}
fclose($openUrl);
/* $url = $_POST['message2'];
$fileName = "url_text_file.txt";
$fetchUrl = curl_init($url);
$urlFile = fopen($fileName, "w");
curl_setopt($fetchUrl, CURLOPT_FILE, $urlFile);
curl_setopt($fetchUrl, CURLOPT_HEADER, 0);
curl_exec($fetchUrl);
curl_close($fetchUrl);
$message = "";
while (!feof($urlFile)) {
$message .= fread($urlFile, 8192);
}
fclose($urlFile);*/
}
Is there another way to get the html code from a url and send it in an email?