homepage Welcome to WebmasterWorld Guest from 23.22.128.96
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How do i change this fopen() to Curl?
john1000




msg:3338060
 1:55 pm on May 12, 2007 (gmt 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]

 

phparion




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved