Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 676267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:54:33+00:00 2026-05-14T00:54:33+00:00

How do I convert the below PHP code to VB.NET? <?php $X_HOST =foo.com; $X_URL

  • 0

How do I convert the below PHP code to VB.NET?

<?php
    $X_HOST ="foo.com";
    $X_URL = "/index.php";
    $X_PORT ="8080";
    $X_USERNAME = "foo";
    $X_PASSWORD = "bar";
    $s_POST_DATA = "Channel=UK.VODAFONE"; // Channel
    $s_POST_DATA .= "&Shortcode=12345"; // Shortcode
    $s_POST_DATA .= "&SourceReference=3456"; // Source Reference
    $s_POST_DATA .= "&MSISDN=447811111111"; // Phone
    $s_POST_DATA .= "&Content=test"; // Content
    $s_POST_DATA .= "&DataType=0"; // Data Type
    $s_POST_DATA .= "&Premium=1"; // Premium
    $s_POST_DATA .= "&CampaignID=4321"; // CampaignID
    $s_Request = "POST ".$X_URL." HTTP/1.0\r\n";
    $s_Request .="Host: ".$X_HOST.":".$X_PORT."\r\n";
    $s_Request .="Authorization: Basic ".base64_encode($X_USERNAME.":".$X_PASSWORD)."\r\n";
    $s_Request .="Content-Type: application/x-www-form-urlencoded\r\n";
    $s_Request .="Content-Length: ".strlen($s_POST_DATA)."\r\n";
    $s_Request .="\r\n".$s_POST_DATA;
    //Sends out the request to the server.
    $fp = fsockopen ($X_HOST, $X_PORT, $errno, $errstr, 30) or die("Error!!!");
    fputs ($fp, $s_Request);
    while (!feof($fp)) {
    $s_GatewayResponse .= fgets ($fp, 128);
    }
    fclose ($fp);
    //Array of official response codes.
    $a_Responses = array(
    "100" => "Server has returned an unspecified error.",
    "101" => "Server successfully received the request.",
    "102" => "Server has returned an database error",
    "103" => "Server has returned an syntax error."
    );
    echo "<HTML>\n<BODY>\n\n";
    //Checks for an official response code.
    foreach ($a_Responses as $s_ResponseCode => $s_ResponseDescription) {
    if (stristr($s_GatewayResponse, "\n$s_ResponseCode\n")) {
    echo "A response code of $s_ResponseCode was returned – ";
    echo $s_ResponseDescription";
    $b_CodeReturned = true;
    }
    }
    //Checks for an authorization failure where an official response code has 
    //not been recognized.
    if (!$b_CodeReturned) {
    if (stristr($s_GatewayResponse, "HTTP/1.1 401")) {
    echo "The server rejected your username/password (HTTP 401).";
    } else {
    echo "No recognised response code was returned by the server.";
    }
    }
    echo "\n\n</BODY>\n</HTML>";
    ?>

and

<?php
    $s_ref = $HTTP_POST_VARS["Reference"]; // Reference
    $s_trg = $HTTP_POST_VARS["Trigger"]; // trigger
    $s_shc = $HTTP_POST_VARS["Shortcode"]; // shortcode
    $s_pho = $HTTP_POST_VARS["MSISDN"]; // MSISDN
    $s_con = $HTTP_POST_VARS["Content"]; // Content
    $s_chn = $HTTP_POST_VARS["Channel"]; // Channel
    $s_pay = $HTTP_POST_VARS["DataType"]; // Data Type
    $s_dat = $HTTP_POST_VARS["DateReceived"]; // Date Received
    $s_cam = $HTTP_POST_VARS["CampaignID"]; // CampaignID
    $b_IsValid = getValidateRequest($s_ref, $s_trg, $s_shc, $s_pho, $s_con, $s_cam, $s_chn, $s_pay, 
    $s_dat);
    if ($b_IsValid) 
    {
    $s_ResponseCode = "success";
    } 
    else 
    {
    $s_ResponseCode = "fail";
    }
    exit($s_ResponseCode);
    /*******************************************************************************/
    function getValidateRequest ($s_req_ref, $s_req_trg, $s_req_shc, $s_req_pho, $s_req_con, $s_req_cam, 
    $s_req_chn, $s_req_pay, $s_req_dat) {
    /*
     * Stub function to be replaced with whatever process is needed to
     * process/validate request from server by specific client requirements.
     */
    return(true);
    }
    ?>

lastly

    <?php
$s_ref = $HTTP_POST_VARS["Reference"]; // Reference
$s_sta = $HTTP_POST_VARS["Status"]; // Status
$s_dat = $HTTP_POST_VARS["DateDelivered"]; // Date Delivered
$b_IsValid = getValidateReceipt($s_ref, $s_sta, $s_dat);
if ($b_IsValid) 
{
$s_ResponseCode = "success";
} 
else 
{
$s_ResponseCode = "fail";
}
exit($s_ResponseCode);
/*******************************************************************************/
function getValidateReceipt ($s_req_ref, $s_req_sta, $s_req_dat) 
{
/*
 * Stub function to be replaced with whatever process is needed to
 * process/validate receipts from server by specific client requirements.
 */
return(true);
}
?>

Thank you very much in advance
Regards
Greg

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:54:33+00:00Added an answer on May 14, 2026 at 12:54 am

    The first bunch of code is just downloading a web page with specific headers & authentication. Check out the HttpWebRequest class.

    The other two chunks of code are just retreiving POST’d data from a client and then it passes those variables to the getValidateReceipt() function that validates what was sent in, note it’s empty though, so it does nothing.

    This looks like old PHP code as using the CURL library and $_POST would be more modern ways of doing things.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 458k
  • Answers 458k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try var_export — Outputs or returns a parsable string representation… May 15, 2026 at 11:08 pm
  • Editorial Team
    Editorial Team added an answer If you want to do the private construtor then you… May 15, 2026 at 11:08 pm
  • Editorial Team
    Editorial Team added an answer Did some quick tests and searched a little, and it's… May 15, 2026 at 11:08 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.