Curl 7hrs later

Curl 7hrs later

Posted by: zenman
Posted on: 2006-06-07 06:06:00

2 wks of reprogramming after switching to dreamhost. Im finally stuck. Im trying to send my HTML news letter to tell people we are back online. Anyway Im done venting! Here is the proplem. I need to replace the function of fopen() and discovered that Curl is my best option. For what ever reason it keeps printing to the screen? and if I change curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0) zero to one it prints twice. Here is the script:
/*Header for email*/
$apiURL = "http://www.investorsclassifieds.com/header_email.php";
$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL,$apiURL);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_exec($ch);
curl_close($ch);


$ads = stripslashes($ads);
$msg .= "<p>$ads
$msg</p>

Re: Curl 7hrs later

Posted by: Atropos7
Posted on: 2006-06-07 11:16:00

$msg .= "<p>$ads$msg</p>"

in English:

message = message + ads + message

which explains why it is printed twice.



cool Perl / MySQL / HTML+CSS

Re: Curl 7hrs later

Posted by: zenman
Posted on: 2006-06-07 14:19:00

Atropos7 - Great Catch! Thanks a TON!!!!

Tags: dreamhosttimeouthttpmsgadsscript headerfopeninitexecprintsreasonphpurl