Welcome to WebmasterWorld Guest from 54.145.53.251

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How do i change this fopen() to Curl?

     
1:55 pm on May 12, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 3, 2005
posts:187
votes: 0


Hello,

I use the below script that shows content from an affiliate address.
But due to security reasons i cant use fopen() anymore,but Curl instead.
Big question (for me) is,how do i change it in this code?
Any help please?..

<?php
$wi = 17176; // Uw affiliate website ID
$ws = WEBSITE_SUBID; // Uw affiliate SubID
// hieronder niets aanpassen
$qs = $_SERVER['QUERY_STRING'];
$ip = $_SERVER['REMOTE_ADDR'];
$domain = urlencode('http://'.$_SERVER['HTTP_HOST'].
$_SERVER['PHP_SELF']);
$file = 'http://www.example.com/whitelabel.php?'
.$qs
.'&wi='.$wi
.'&ws='.$ws
.'&bedankt='.$domain
.'&ip='.$ip;
$fp = fopen($file, 'r');
while(true) {
$content = fread($fp, 8192);
if (strlen($content) == 0) break;
$data .= $content;
} fclose ($fp);
print $data;
?>

This is all the code.

[edited by: jatar_k at 4:27 pm (utc) on May 12, 2007]
[edit reason] switched to example.com [/edit]

5:31 pm on May 12, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 9, 2005
posts:817
votes: 0


it should be a straight forward cURL session. www.php.net/curl you can follow any example there to accomplish your task