Converting code that uses fopen to curl because host is blocking fopen

I’m working on WordPress and I know literally nothing about PHP. I’m trying to get a scroller with post excerpts to work but it uses fopen() but it is turned off on my customers’ host.

$f = fopen( $url, 'r' );

while( $data = fread( $f, 4096 ) ) { $xml .= $data; }

fclose( $f );

Can this simply be written into curl?

Read More

Thanks in advance!

Related posts

Leave a Reply

2 comments

  1. $ch = curl_init();
    curl_setopt ($ch, CURLOPT_URL, $url);
    curl_setopt ($ch, CURLOPT_HEADER, 0);
    curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    curl_close ($ch);