CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > migration_to_asp.net.migrating_from_php_to_asp.net Tags:
Item Type: NewsGroup Date Entered: 9/10/2007 7:32:34 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 112 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
gettomenm
Asp.Net User
converting php code to c# help9/10/2007 7:32:34 AM

0/0

Hello,

I am completely new  to c# and need to convert below code fo php to c#.Any help will be much appreciated .

define('LOGIN_URL', 'http://signin.ebay.com/aw-cgi/eBayISAPI.dll');
define('FILE_EXCHANGE_URL', 'http://bulksell.ebay.com/ws/eBayISAPI.dll');
define('DOWNLOAD_URL', 'http://k2b-bulk.ebay.com/ws/eBayISAPI.dll');

class eFileExchange {
var $emailAddr=null;
var $cookiePath ="YOUR COOKIES PATH";
var $rawxml=null;
var $records=array();
var $Logging = false;
var $Debug = false;
var $retries=0;

function eFileExchange($emailAddress, $ebayUser, $ebayPass) {

$this->emailAddr=$emailAddress;
$return=$this->eBayPost(LOGIN_URL."?SignIn");

$POSTFIELDS = 'MfcISAPICommand=SignInWelcome&siteid=0&co_partnerId=2&UsingSSL=0&ru=&pp=&pa1=&pa2=&pa3=&i1=-1&pageType=-1&userid='. $ebayUser .'&pass='. $ebayPass;
$reffer = FILE_EXCHANGE_URL."?FileExchangeUploadForm";
$return=$this->eBayPost(LOGIN_URL, $reffer, null, $POSTFIELDS);
}

 


function DownloadFile($url) {
$this->records=explode(chr(13), $this->records[0]);

$url=str_replace ("&", "&", $url);


$handle=fopen("EbayReport.tmp", "w+");
fwrite($handle, $this->eBayPost($url));
rewind($handle);
$row=0;
while (($this->records[] = fgetcsv($handle, 200000, ",")) !== FALSE) {
if ($row==0) { $this->records = array(); }
$row++;
}
fclose($handle);
return $this->records;


}

function ViewDownloads() {
$this->rawxml= $this->eBayPost(DOWNLOAD_URL."?SMDownloadPickup&ssPageName=STRK:ME:LNLK");

$this->rawxml=substr($this->rawxml, strpos(strtolower($this->rawxml), ">90 days<"), 3000000);
$this->rawxml=substr($this->rawxml, strpos(strtolower($this->rawxml), "<table")+1, 3000000);
$this->rawxml=substr($this->rawxml, strpos(strtolower($this->rawxml), "<table")-1, 3000000);
$this->rawxml=substr($this->rawxml, 1, strpos(strtolower($this->rawxml), "</table>")+8 );

$this->rawxml=str_replace('">Download', '', str_replace('"."[[:space:]]+"."<", "><", $this->rawxml);
//get rid of superfluous line terminators
$this->rawxml=str_replace ("\n", " ", $this->rawxml);
$this->rawxml=str_replace ("\r\n", " ", $this->rawxml);
//trim anything hanging on the beginning or end
$this->rawxml=addslashes(trim($this->rawxml));

$rarr=array();
//removes all tags and leaves data in array elements
$rarr=preg_split('/<[^>]+>/ix',$this->rawxml, -1, PREG_SPLIT_NO_EMPTY );


//Interpretation
if (isset($rarr[0])) {
$this->records=$rarr;
} else {
$this->records[0]='Amazon returned XML tags with no data between them which may mean that there is nothing to return.';
}

if ($this->Debug) {
echo "
";              print_r($this->records);              echo "
";
}
return;
}

function eBayPost($url, $Referrer=null, $Headers=null, $Data=null) {
/* added this as a dying curl wrapper for eBayPost1 */

$rc=$this->eBayPost1($url, $Referrer, $Headers, $Data);
if ($rc == 'FATAL ERROR: Curl failed.') {
echo $rc." RETRY 1
\n";
sleep(10);
$rc=$this->eBayPost1($url, $Referrer, $Headers, $Data);
if ($rc == 'FATAL ERROR: Curl failed.') {
echo $rc." RETRY 2
\n";
sleep(10);
$rc=$this->eBayPost1($url, $Referrer, $Headers, $Data);
}
}
return $rc;
}

function eBayPost1($url, $Referrer=null, $Headers=null, $Data=null) {
// $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)";
$agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7";

// Use built-in curl libraries
if (function_exists("curl_init"))
{

if ($this->Debug) {
echo "
HTTP HEADERS
";
echo "
";             print_r($Headers);             echo "
";
if (!is_null($Data)) {
echo "
INVENTORY DATA
";
echo "
";                echo $Data;                echo "
";
}
}

// Set Locale
if ($this->Locale != US) {
$url = str_replace(US, $this->Locale, $url);
}

// Curl is available. If curl_init succeeds, then SSL is
// Available
if (!$ch = curl_init())
{
return false;
}

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookiePath);
curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookiePath);
if (!is_null($Headers))
{
curl_setopt($ch, CURLOPT_HTTPHEADER, $Headers);
}
if (!is_null($Data))
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $Data);
}

if (!is_null($Referrer))
{
if ($this->Locale != US) {
$url = str_replace(US, $this->Locale, $Referrer);
}
curl_setopt($ch, CURLOPT_REFERER, $Referrer);
}

if ($this->Logging)
{
// Record all headers in the file DEBUG_FILE
curl_setopt($ch, CURLOPT_VERBOSE, true);
$fh = fopen(LOGGING_FILE, 'a');
curl_setopt($ch, CURLOPT_STDERR, $fh);
}


if (!($data_out = curl_exec($ch)))
{
if ($this->Debug)
{
echo "
CURL SESSION
";
print_r(curl_getinfo($ch));
}

curl_close($ch);

if ($this->Logging)
{
$datestr = date("F j Y h:i:s A");
$errstr = "$datestr: Curl_exec failed - curl_error($ch)\n";
error_log($errstr, 3, ERROR_LOG);
}
return 'FATAL ERROR: Curl failed.';
}
else
{
$this->retries=0;
if ($this->Debug)
{
echo "
CURL SESSION
";
print_r(curl_getinfo($ch));
echo "
RAW OUTPUT
";
echo htmlspecialchars($data_out, ENT_QUOTES);
}
curl_close($ch);
return $data_out;
}
}
else
{
die('Curl not available.');
}

}

 

 

}

ca8msm
Asp.Net User
Re: converting php code to c# help9/10/2007 8:06:02 AM

0/0

This may help you:

http://www.asp.net/downloads/archived/migration-assistants/php-to-aspnet/ 


Mark,
http://aspnetlibrary.com
http://mdssolutions.co.uk - Delivering professional ASP.NET solutions
http://weblogs.asp.net/marksmith


Please remember to click "Mark as Answer" on this post if it helped you.
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Programming PHP Authors: Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre, Pages: 521, Published: 2006
PHP and MySQL Web Development Authors: Luke Welling, Laura Thomson, Pages: 871, Published: 2003
Foundation PHP for Dreamweaver 8 Authors: David Powers, Pages: 510, Published: 2005
Information Technology for Energy Managers Authors: Barney L. Capehart, Pages: 426, Published: 2004
PHP5 and MySQL Bible Authors: Tim Converse, Joyce Park, Clark Morgan, Pages: 1042, Published: 2004
PHP Solutions: Dynamic Web Design Made Easy: Dynamic Web Design Made Easy Authors: David Powers, Pages: 468, Published: 2006
PHP Developer's Cookbook Authors: Sterling Hughes, Andrei Zmievski, Pages: 504, Published: 2001
Beginning PHP and Oracle: From Novice to Professional Authors: W. Jason Gilmore, Bob Bryla, Pages: 763, Published: 2007
Programming Firefox: Building Applications in the Browser Authors: Kenneth C. Feldt, Pages: 494, Published: 2007
Foundation PHP 5 for Flash Authors: David Powers, Pages: 699, Published: 2005

Web:
Convert PHP to StandAlone Program - Tech Support Forums - TechIMO.com Any help is appreciated. Thanks. ChoaticWhisper is offline ... as it just converts PHP to C++ code, doesn't really create a true app. ...
Help Convert Obj-C Code to PHP - MacNN Forums Hi All, I'm delving into Obj-C and php and I am wondering if someone can help me translate the code below to php.
Help converting short php script to ASP - bytes You have the querystring lines commented out in your PHP code. ... news:MPG. [email protected] om...[color=blue] ...
convert PHP code to C - CodingForums.com so i decided to convert my PHP code to C .. ... any help will be appreciated ... thanks ... c:\path\to\php.exe -q -f c:\path.script.php ...
Converting PHP to C and I need a little help - GIDForums Converting PHP to C and I need a little help C Programming Language. ... Basically all I did was take my PHP code and thak the function that ...
Please help me convert this to wml php script - Dev Shed Visit Dev Shed to discuss Please help me convert this to wml php script. ... PHP Code:. '; ...
Help to improve c code(convert sentence) - Linux Forums Help to improve c code(convert sentence) Linux Programming & Scripting. ... PHP Code:. /* * pipe2.c - two processes communicating both ways ...
converting perl script to php help!! - ProgrammingTalk converting perl script to php help!! Perl. ... $name =~ s/%([a-fA-F0-9][a-fA-F0- 9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; ...
Programmer's Heaven - Ruby, .NET, C#, C++, PHP, Python, Java ... Dec 25, 2008 ... Resources for developers in C, C++, C#, .Net, Visual Basic, Java, Ruby, PHP, Perl, Python and more. Featuring forums, tens of thousands of ...
GetAFreelancer.com - Converting Php to C Jul 31, 2006 ... Converting Php to C is project number 77588 posted at GetAFreelancer.com. ... i can help. btw why a lot of non-break space in the code? ...

Videos:
semantics of PHP fill in details here. I hope to continue developing plans here over the next week or so at least. There may be no guarantee that my posts will ...
Unbrick Your PSP (Pandora Online Manual) (im not responsible for any damage will cause this to your psp) Big ONE: All for one, and one for all. A project promulgated under the collective ...
FFMPEG #74 FFmpeg Documentation http://ffmpeg.mplayerhq.hu/ --enable-static --disable-shared and for a build with shared libraries ./configure --target-os=mingw32 --enable ...
An Introduction to SQLite Google TechTalks May 31, 2006 Richard Hipp ABSTRACT SQLite is a small C library that implements a self-contained, embeddable, zero ...
Downloading Youtube Videos to a Samsung T10,T9 This video demonstrates how I now download and convert videos from youtube to my Samsung T10 player. Use Jsvicoder if you have Ubuntu. The ...
BeGeistert 014 Interview of yellowTAB During BeGeistert 014 (April 2-3, 2005) Daniel "daat" Teixeira from IsComputerOn and Chris Simmons from Haiku News spent 40 minutes interviewing ...
Lies In The Textbooks - Creationist Kent Hovind Reveals The ... Lies In The Textbooks - Creation Scientist Kent Hovind Reveals The Truth Abut Evolution! For more videos like this please visit http://www.drdino ...




Search This Site:










how-to put data from a db into (for example) a session

for each...

which is $_request[variable] similar contol in asp.net

creating a ftp access

retriving data from db and parsing

how can i use arrays like $_post[] or $_get[] in asp.net ?

convert php script to asp.net

from php to asp ,

can any one help me translating this php code to aspx?? =)

classes (extended)

code from perl to asp.net

checking check boxes

php style includes

custom error page

commenting

the equivilant of $_session()

how to include a file from an external server in an asp page

(hopefully) simple conversion needed

php class vs. asp.net/c# class

passing variables from asp.net to php via http get (variable with chinese characters)

ternary operator + string concatenation

mysql_insert_id...equiv in asp.net

dynamic php include to c#

phalanger: php for .net

include files en asp net

is asp.net overkill?

associated arrays => hashtable ?

http_get is asp

concatenating an iterator onto a string

migrating a php bot check application for flash to asp.net !!! seo !

  Privacy | Contact Us
All Times Are GMT