Breaking News

Tuesday, May 21, 2013

WordPress: Call ASMX web service from PHP?

How about a scenario, where you have a brand new virgin machine, and you have been asked a question on how, a php code would call an asmx from a WordPress website?



So, you have literally nothing: No visual studio, no TextPad, no Notepad++, no IIS installed anywhere over the network, no php editor, no server to deploy php code -- Do you think you can answer the question? No?



Think again!

1. Access to internet -- is enough! http://writecodeonline.com/php/ gives you an interface to run and test your php code. As well as http://codepad.org/, and http://ideone.com/ provides online IDE interface.

2. Now, how to test calling an ASP.NET web service? Google... for free online ASP.NET web services, you'd find lots. Following simple services helped us with the testing:
Following code goes into the php script file:

echo "Script Start\n\n";
try
{
//1. create object
$client = new SoapClient("http://www.webservicex.net/stockquote.asmx?wsdl");

//2. fill params
$object = new stdClass();
$object->symbol = "MSFT";

//3. Call web method
print_r($client->GetQuote($
object)->GetQuoteResult);
}

catch (SoapFault $exception) { echo $exception; }
echo "Script complete\n\n";

Worked fairly well.

Enjoy!

8 comments:

  1. Anonymous5:10 AM

    Hi Salam walekum,this is Naseem I have developed one site in wordpress now i want to consume webservices inside the page like Events, Testimonials, News etc.how its possible.Plz help me my email id is naseemshekh20@gmail.com

    Thanks

    ReplyDelete
  2. Anonymous8:34 PM

    Hi.. Is these possible to add my asp.net WCF services to WordPress page

    ReplyDelete
  3. Really Nice Information,Thank You Very Much For Sharing.
    Wordpress Development Company

    ReplyDelete
  4. The best things in life are free, as they say; knowledge is free and lucky for you, WordPress is free too. The first things you need to do are to visit WordPress's website, and download the latest version of WordPress. https://edkentmedia.com/website-design-toronto

    ReplyDelete
  5. Anonymous5:43 AM

    Drivers for all kinds of devices: https://huaweidrivers.com/

    ReplyDelete
  6. Showbox not Working for Android Are you having problems with the ShowBox app? Here are all of the common errors, issues, and problems for ShowBox and how to fix them! Common issues .

    ReplyDelete
  7. Great client service is moving above and over and above of responsibility. Moving above and beyond only helping someone. That modest extra mile. It is going far above what your usual job duties are. Whatever they're looking to receive as service as towards service or their product, you exceed to allow it to happen to get your own client. And it's really more than simply providing the support, it's genuinely believing in your product or your ceremony and helping the customer in order that they see that the value from that too. You can find Details on This Issue on This Sitehttps://servicecenterguru.com

    ReplyDelete

Designed By Published.. Blogger Templates