Visa signatur
...
Jag skulle behöva få nedanstående funktion i PHP översatt till asp eller asp.net, spelar inget roll vilket.
Vet knappt själv vad funktionen gör, men nåt med email piping iaf.
Om någon kunde hjälpa till med detta skulle det va grymt uppskattat!
<?php
#pre-checks
function_exists('file_get_contents') or die('upgrade php >=4.3');
set_time_limit(30);
#Configuration: Enter the url and key. That is it.
# url=> URL to pipe.php e.g http://yourdomain.com/support/api/pipe.php
# key=> API's Key (see admin panel on how to generate a key)
$config=array('url'=>'http://yourdomain.com/support/api/pipe.php',
'key'=>'API KEY HERE');
#read stdin
$data=file_get_contents('php://stdin');
if(empty($data)) die('Error reading stdin. No message');
#curl post
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$config['url']);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_USERAGENT,$config['key']);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($ch);
curl_close($ch);
$code=0;
if(preg_match('/HTTP\/.* ([0-9]+) .*/', $result, $status))
$code=$status[1];
//Depending on your MTA add the exit codes.
//echo $code;
?>
...
Jag har aldrig varit i kontakt med curl så jag vet inte vad den gör men ta reda på vad koden gör och hitta en motsvarande funktion i asp
Får jag fråga varför du vill konvertera en kod du knappt vet vad den gör?
Copyright © 1999–2024 Geeks AB. Allt innehåll tillhör Geeks AB.
Citering är tillåten om källan anges.