PersianHero Posted January 27, 2013 Share Posted January 27, 2013 (edited) I've just moved to new server and got this error due to webmaster has disabled this function(because of security reasons): Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/public_html/files/ym/status.php on line 3 Here is the content of status.php: <?php if(!empty($_GET['id']) || !empty($_GET['img']) ) { $status = file_get_contents("http://mail.opi.yahoo.com/online?u=".$_GET['id']."&m=a&t=1"); $file = './icon/'.$status.'/'.$_GET['img'].'.gif'; if(is_file($file)) { header("Content-type: image/gif"); readfile($file); } } ?> Does any one can help me out to change this function or create new code to do so? ------- More information: I put this code into index.html to call status.php <a href="ymsgr:sendim?yahooID"><div id="product" style="background:url(ym/status.php?id=yahooID&img=sup1) 0 0 no-repeat;"> I appreciate sharing your knowledge P.S. I've attached entire of /ym folder Edited January 27, 2013 by PersianHero Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/ Share on other sites More sharing options...
Jessica Posted January 27, 2013 Share Posted January 27, 2013 Check into using cURL. Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408556 Share on other sites More sharing options...
PersianHero Posted January 27, 2013 Author Share Posted January 27, 2013 Check into using cURL. I'm not goot at programming. Can you help me please? Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408564 Share on other sites More sharing options...
Zane Posted January 27, 2013 Share Posted January 27, 2013 http://stackoverflow.com/a/3488430 Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408565 Share on other sites More sharing options...
Jessica Posted January 27, 2013 Share Posted January 27, 2013 Are you goot at using Google? Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408566 Share on other sites More sharing options...
PersianHero Posted January 28, 2013 Author Share Posted January 28, 2013 (edited) I did but sadly i couldn't manage to do that. Can anyone help me to change this function to "cURL"? Edited January 28, 2013 by PersianHero Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408621 Share on other sites More sharing options...
Barand Posted January 28, 2013 Share Posted January 28, 2013 I thought Zane had done that for you in his reply Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408633 Share on other sites More sharing options...
PersianHero Posted January 28, 2013 Author Share Posted January 28, 2013 (edited) Yes. But not completely Edited January 28, 2013 by PersianHero Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408635 Share on other sites More sharing options...
PersianHero Posted January 28, 2013 Author Share Posted January 28, 2013 (edited) I know I should use cURL function rather than file_get_contents but i don't know how. I'd appreciate if someone can change this code to "cURL" function. <?php if(!empty($_GET['id']) || !empty($_GET['img']) ) { $status = file_get_contents("http://mail.opi.yahoo.com/online?u=".$_GET['id']."&m=a&t=1"); $file = './icon/'.$status.'/'.$_GET['img'].'.gif'; if(is_file($file)) { header("Content-type: image/gif"); readfile($file); } } ?> Edited January 28, 2013 by PersianHero Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408636 Share on other sites More sharing options...
Barand Posted January 28, 2013 Share Posted January 28, 2013 Did you read the link that Zane posted? It would not appear so Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408637 Share on other sites More sharing options...
PersianHero Posted January 28, 2013 Author Share Posted January 28, 2013 (edited) Yes i did. But it was in professional way. I'm amateur mate. Edited January 28, 2013 by PersianHero Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408640 Share on other sites More sharing options...
Barand Posted January 28, 2013 Share Posted January 28, 2013 Where amateur === copy and paste is beyond me? Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408643 Share on other sites More sharing options...
PersianHero Posted January 28, 2013 Author Share Posted January 28, 2013 (edited) Where amateur === copy and paste is beyond me? I'm here to learn something new from you. Are you supposed to blame me or solve my problem? If I were you, I would help someone who needs my help rather than...! I think here is not right place to solve the problem. I marked the topic as solved. Please delete this topic. Thanks Edited January 28, 2013 by PersianHero Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408650 Share on other sites More sharing options...
Barand Posted January 28, 2013 Share Posted January 28, 2013 The link given to you contained this code function get_content($URL){ $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $URL); $data = curl_exec($ch); curl_close($ch); return $data; } That should be a pretty good start to your solution. But if you want to to throw your rattle out of the pram then that's OK. Bye!. Quote Link to comment https://forums.phpfreaks.com/topic/273697-alternative-codes-for-y-status/#findComment-1408651 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.