Преобразование кода PHP в C# windows forme application
Привет
Я-конвертер PHP-кода в C #, может ли кто-нибудь это сделать?
<center> <form method="post"> <br /> <textarea id="url" name="url_form" cols="40" rows="8" style="width: 400px"> </textarea > <br /> <input type="submit" style="margin-top: 5px; font-size: 18px" value="Check" /> </form> </center> <?php if($_REQUEST['url_form']) { $urls = trim($_POST['url_form']); $urls = explode("\n", $urls); $urls = array_filter($urls, 'trim'); } if(!$urls) { exit; } ?> <div style="margin: auto; width: 50%; min-width: 400px"> <table width="500" cellpadding="5" cellspacing="5"> <thead style="text-align: left"> <tr> <th>ID</th> <th>URL</th> <th>DA</th> <th>PA</th> <th>MR</th> <th>EL</th> </tr> </thead> <tbody> <?php $check_count = 0; $urls_metrics = array(); $chunked_verified_urls = array_chunk($urls,80); foreach($chunked_verified_urls as $chunk_section) { sleep(2); unset($url); $url = $chunk_section; $seomoz_metrics = getSeomozMetrics($url); if($seomoz_metrics['error'] != '') { echo "Error[SEOMoz]: ".$seomoz_metrics['error']."<br>"; } else { foreach($seomoz_metrics as $index => $seomoz_metric) { $url_metrics['pa'] = number_format($seomoz_metric['pa'], 0, '.', ''); $url_metrics['url'] = $seomoz_metric['url']; $url_metrics['da'] = number_format($seomoz_metric['da'], 0, '.', ''); $url_metrics['title'] = $seomoz_metric['title']; $url_metrics['external_links'] = $seomoz_metric['external_links']; $url_metrics['mozrank'] = number_format($seomoz_metric['mozrank'], 2, '.', ''); $check_count ; echo "<tr><td>"; echo $check_count; echo "</td><td>"; echo str_replace("http://","",$url_metrics['url']); echo "</td><td>"; echo $url_metrics['da']; echo "</td><td>"; echo $url_metrics['pa']; echo "</td><td>"; echo $url_metrics['mozrank']; echo "</td><td>"; echo $url_metrics['external_links']; echo "</td>"; echo "</tr>"; $urls_metrics[] = $url_metrics; } } } ?> </tbody></table> </div> <?php function getSeomozMetrics($objectURL) { $accessID = "accessID"; $secretKey = "secretKey"; $expires = time() 600; $stringToSign = $accessID."\n".$expires; $binarySignature = hash_hmac('sha1', $stringToSign, $secretKey, true); $urlSafeSignature = urlencode(base64_encode($binarySignature)); $cols = 68719476736 34359738368 536870912 32768 16384 2048 32 4; $requestUrl = "http://lsapi.seomoz.com/linkscape/url-metrics/?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature; $batchedDomains = $objectURL; $encodedDomains = json_encode($batchedDomains); $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $encodedDomains ); $ch = curl_init($requestUrl); curl_setopt_array($ch, $options); $content = curl_exec($ch); curl_close( $ch ); $response = json_decode($content,true); $count = 0; if (isset($response['error_message'])) { $metric_list = array('error'=>$response['error_message']); } else { foreach($response as $site_metric) { $metric_list[$count]['url'] = $objectURL[$count]; $metric_list[$count]['subdomain'] = $site_metric['ufq']; $metric_list[$count]['domain'] = $site_metric['upl']; $metric_list[$count]['pa'] = $site_metric['upa']; $metric_list[$count]['da'] = $site_metric['pda']; $metric_list[$count]['mozrank'] = $site_metric['umrp']; $metric_list[$count]['title'] = $site_metric['ut']; $metric_list[$count]['external_links'] = $site_metric['ueid']; $count ; } } return $metric_list; } ?>
Что я уже пробовал:
Привет
Я-конвертер PHP-кода в C #, может ли кто-нибудь это сделать?
<center> <form method="post"> <br /> <textarea id="url" name="url_form" cols="40" rows="8" style="width: 400px"> </textarea > <br /> <input type="submit" style="margin-top: 5px; font-size: 18px" value="Check" /> </form> </center> <?php if($_REQUEST['url_form']) { $urls = trim($_POST['url_form']); $urls = explode("\n", $urls); $urls = array_filter($urls, 'trim'); } if(!$urls) { exit; } ?> <div style="margin: auto; width: 50%; min-width: 400px"> <table width="500" cellpadding="5" cellspacing="5"> <thead style="text-align: left"> <tr> <th>ID</th> <th>URL</th> <th>DA</th> <th>PA</th> <th>MR</th> <th>EL</th> </tr> </thead> <tbody> <?php $check_count = 0; $urls_metrics = array(); $chunked_verified_urls = array_chunk($urls,80); foreach($chunked_verified_urls as $chunk_section) { sleep(2); unset($url); $url = $chunk_section; $seomoz_metrics = getSeomozMetrics($url); if($seomoz_metrics['error'] != '') { echo "Error[SEOMoz]: ".$seomoz_metrics['error']."<br>"; } else { foreach($seomoz_metrics as $index => $seomoz_metric) { $url_metrics['pa'] = number_format($seomoz_metric['pa'], 0, '.', ''); $url_metrics['url'] = $seomoz_metric['url']; $url_metrics['da'] = number_format($seomoz_metric['da'], 0, '.', ''); $url_metrics['title'] = $seomoz_metric['title']; $url_metrics['external_links'] = $seomoz_metric['external_links']; $url_metrics['mozrank'] = number_format($seomoz_metric['mozrank'], 2, '.', ''); $check_count ; echo "<tr><td>"; echo $check_count; echo "</td><td>"; echo str_replace("http://","",$url_metrics['url']); echo "</td><td>"; echo $url_metrics['da']; echo "</td><td>"; echo $url_metrics['pa']; echo "</td><td>"; echo $url_metrics['mozrank']; echo "</td><td>"; echo $url_metrics['external_links']; echo "</td>"; echo "</tr>"; $urls_metrics[] = $url_metrics; } } } ?> </tbody></table> </div> <?php function getSeomozMetrics($objectURL) { $accessID = "accessID"; $secretKey = "secretKey"; $expires = time() 600; $stringToSign = $accessID."\n".$expires; $binarySignature = hash_hmac('sha1', $stringToSign, $secretKey, true); $urlSafeSignature = urlencode(base64_encode($binarySignature)); $cols = 68719476736 34359738368 536870912 32768 16384 2048 32 4; $requestUrl = "http://lsapi.seomoz.com/linkscape/url-metrics/?Cols=".$cols."&AccessID=".$accessID."&Expires=".$expires."&Signature=".$urlSafeSignature; $batchedDomains = $objectURL; $encodedDomains = json_encode($batchedDomains); $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $encodedDomains ); $ch = curl_init($requestUrl); curl_setopt_array($ch, $options); $content = curl_exec($ch); curl_close( $ch ); $response = json_decode($content,true); $count = 0; if (isset($response['error_message'])) { $metric_list = array('error'=>$response['error_message']); } else { foreach($response as $site_metric) { $metric_list[$count]['url'] = $objectURL[$count]; $metric_list[$count]['subdomain'] = $site_metric['ufq']; $metric_list[$count]['domain'] = $site_metric['upl']; $metric_list[$count]['pa'] = $site_metric['upa']; $metric_list[$count]['da'] = $site_metric['pda']; $metric_list[$count]['mozrank'] = $site_metric['umrp']; $metric_list[$count]['title'] = $site_metric['ut']; $metric_list[$count]['external_links'] = $site_metric['ueid']; $count ; } } return $metric_list; } ?>
ZurdoDev
Что?
[no name]
"Я-конвертер PHP-кода в C#", а вы? Тогда у вас не должно быть никаких проблем с этим. Однако мы не являемся службой перевода кодов.