On Mon, 2 Feb 2004, Richard Miller said:
> Here is my code:
> 
> if (!($fh = fopen($FILENAME, "w")))
>       die ("Could not open " . $FILENAME . "!");
> 
> $ch = curl_init();
> 
> curl_setopt($ch, CURLOPT_HEADER, 0);
> curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($ch, CURLOPT_URL, $WSJURL);
> curl_setopt($ch, CURLOPT_COOKIE, $mycookie);
> curl_setopt($ch, CURLOPT_FILE, $fh);
> 
> fclose($fh);
> 
> curl_exec($ch);
> curl_close($ch);
> 
> $fh2 = fopen($FILENAME, "r");
> 
> 
> I guess I thought it was inefficient to write the curl output to disk 
> and then read it back in again later.  If you don't save the curl 
> output to a file it is sent to stdout.  Is there a better way?

# return the result, rather than outputting to browser
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $HTML = curl_exec($ch);

Frank
---------------------------------------------------------------------------
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
[EMAIL PROTECTED]

____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to