Find Jobs
Hire Freelancers

Convert PHP to C

$30-100 USD

已关闭
已发布超过 18 年前

$30-100 USD

货到付款
Trying to recode my php script into c to run on linux... Hi guys, My first post here, I already love this place , it's huge and hopefully I can get some help to do this project of mine. Here's what I need to do. I need to take my php script that I coded, and translate it into c from php. What tools will I need to do this? I wrote and tested the script with just notepad, so I'm sure I'm going to need tools to build and test this script in c. My platform I am coding in is windows xp professional 2. The platform(s) I would like it to run on are linux (1st importance) and windows xp would be nice if it was easy, most important is linux however (centos 4 with cpanel/whm but you probably didn't need that much info). Here is the basic functions my script has... [quote] Here is the script, i modified it a little bit here and there, changed some words and names. I believe I fixed the error about it timing out, or at least I pray I did. It's been running for two hours and still seems to be loading which is good, I just had to have it display something every 10 seconds or the browser would eventually time out. Any ideas on how to easily convert this to C or Perl (perferably c)? I can give a few snippets (edited variable names of course) [/quote] [quote] class MYFUNCTION { var $PROXY_LIST=false; var $CURRENT_PROXY=false; var $useProxies=false; var $proxyPath = '[login to view URL]'; var $max_out = 100000; var $time_delay = 1; var $extra_bar=0;//0= no limit var $named_list=null; var $stopat=null; var $fileName ="whatisthefilename.txt"; var $fileMode ="w"; var $numRequests=0; function GoForIt() { set_time_limit(0);//this may take awhile. $totalsize=9; $i=0; $d=0; while($i < $totalsize && $d depth) { if($this->useProxies) $this->GetNextProxy(); $this->ANOTHERFUNCTIONHERE($this->named_list[$i]); $totalsize = count($this->named_list); if($max_out >= $this->extra_bar) break; if($this->depth>0) $d++; $i++; sleep($this->time_delay); } $this->SaveToFile(); } /******************************************************************** * Get the next anonymous proxy from the [login to view URL] file * When the last proxy is reached it goes back to the first * proxies should be just the proxy ip and port and a new line *********************************************************************/ function GetNextProxy() { // if the current_proxy is false, then load the proxy file if(!$this->CURRENT_PROXY) { $handle = fopen($this->proxyPath, "rb"); if($handle == false) { echo "Please upload a proxy list. or untick the proxy list, moron!"; exit; } elseif ($handle == true) { $this->PROXY_LIST = fread($handle, filesize('proxies/[login to view URL]')); fclose($handle); $this->PROXY_LIST = explode("n", $this->PROXY_LIST); $this->CURRENT_PROXY = current($this->PROXY_LIST); } } else { //get the next proxy from the array $this->CURRENT_PROXY = next($this->PROXY_LIST); //if used all proxies then get the first proxy if(!$this->CURRENT_PROXY) $this->CURRENT_PROXY = reset($this->PROXY_LIST); } } function BLAHBLAHBLAH($result) { if(is_array($result)) foreach($result as $value) { $value = strip_tags($value); $value = trim($value); if (!in_array($value,$this->named_list)) { if($this->stopat!=null && $this->stopat($value)) $this->named_list[] = $value; else $this->named_list[] = $value; } } } 7 [/quote] and you execute the script by doing this: [quote] set_time_limit(0); ignore_user_abort(1); require_once("./other.file.class.php"); /******************************/ /* CONFIG-BEGIN */ /******************************/ $list = file("list.txt"); $_GET["useVarONE"] = 1; $sz = sizeof($list); // START LOOP for($l=0;$lPath = dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']); $CFG->savefile = $CFG->Path."/dir/test_file_output.txt"; $NameOfClass->fileName = $CFG->savefile; if(isset($_GET['useExample1'])) $NameOfClass->useExample1 =true; if(isset($_GET['useProxies'])) { $NameOfClass->useProxies =true; $NameOfClass->proxyPath = $CFG->Path."/proxies/proxies.txt"; } if(isset($_GET['badwords'])) if($_GET['badwords'] != "") $NameOfClass->Badwords = explode("n",$_GET['badwords']); //$_GET["words"] = file_get_contents("list.txt"); $_GET["words"] = $list[$l]; if(!isset($_GET['words'])){ echo "Word file is not valid"; } else{ //$NameOfClass->example_list = explode("n", $_GET['words']); $NameOfClass->example_list = $list[$l]; $NameOfClass->example_list = explode("n", $_GET['words']); $NameOfClass->example_list[0] = trim($NameOfClass->example_list[0]); $NameOfClass->fileName = "kws/".$NameOfClass->example_list[0].".txt"; // $NameOfClass->fileName = str_replace(" ","",$NameOfClass->fileName); $NameOfClass->GetClassExample(); } } [/quote] Ok that's just the basics of it,the entire php script is like 4 times longer so I really cut this out just so it's like one example of each, so if I could find out how to do it for one of each example I gave, I'm sure I can code the entire rest of the script myself. The REASON for recoding this into C instead of leaving it in PHP , is that this script is supposed to be running 24/7, non stop, and in php, even with the set_time_limit to unlimted time to run, APACHE crashes after running it for like an hour or two, because it's CONSTANTLY processing based on a VERY HUGE [login to view URL], and also from what it DOES with that list.txt. You could call it a content processor. If this was recoded into C, I believe it would be more stable and wouldn't crash as much, and also I could run it in the background so it wouldn't be in the way. Who can assist me in what I am doing? I am quite knowledgeable coding in php and I know just a BIT of c++ from several years ago, I haven't touched it in a while, but hopefully I can redo this php script into c easily. Thanks in advance!!!
项目 ID: 41939

关于此项目

9提案
远程项目
活跃17 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
9威客以平均价$72 USD来参与此工作竞价
用户头像
Hi! i can do it less then in 4 hours. Regards, Sergey.
$75 USD 在0天之内
4.7 (35条评论)
6.0
6.0
用户头像
Hi, I think I can do it:-)! Best regards, rentacoder:-)
$88 USD 在8天之内
5.0 (30条评论)
4.9
4.9
用户头像
Dear sir. We will deliver the result within 3 hours. Hope your cooperation. Thanks & Regards.
$50 USD 在0天之内
5.0 (2条评论)
2.4
2.4
用户头像
Please see private message area.
$100 USD 在5天之内
0.0 (0条评论)
0.0
0.0
用户头像
I have done this type of thing previously. Please see the pmb.
$40 USD 在2天之内
0.0 (0条评论)
0.0
0.0
用户头像
Will gladly port your application to Linux. Additionally, I will implement pipelinig so that your application is able to test multiple proxies at the same time (performance increase).
$100 USD 在11天之内
0.0 (0条评论)
0.0
0.0
用户头像
I did this before. Nothing complicated. I can do it. Best regards.
$75 USD 在8天之内
0.0 (0条评论)
0.0
0.0
用户头像
It's a easy.
$30 USD 在1天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
Chicago, United States
0.0
0
会员自1月 30, 2006起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。