PDA

View Full Version : سوال: استفاده از وب سرویس PHP در ASP.Net



Peysab
سه شنبه 17 اردیبهشت 1387, 13:46 عصر
سلام دوستان من میخوام از وب سرویس سایت www.Iranmarketcenter.com که با PHP میباشد برای سایت خودم www.PersianDivX.net استفاده کنم که با ASP.Net نوشته شده در پائین صفحه کد PHP که شرکت به من داده رو میزارم راهنمائیم کنید چه جوری دیتا ها رو به این وبسرویس ارسال کنم و ازش خروجی بگیرم؟؟؟


<?php

class Factor
{
private $Username;
private $Password;
private $ProductCount;
private $ProductSumPrice;
private $ProductSumWeight;
private $SendPrice;
private $ProductsQuery;
private $CustomerQuery;
private $FactorKey;
private $SendType;
private $URL;

function Factor($username,$password,$SendType=0)
{
$this->ProductCount=0;
$this->SendType=$SendType;
$this->ProductSumPrice=0;
$this->SendPrice=0;
$this->Username=$username;
$this->Password=$password;
$this->URL="http://30ds.com/Webservice/";
}

function ProductAdd($PID,$Name,$Price,$Weight,$Count)
{
$this->ProductsQuery.="$PID^$Name^$Price^$Weight^$Count;";
$this->ProductCount++;
$this->ProductSumPrice+=($Price*$Count);
$this->ProductSumWeight+=($Weight*$Count);
return true;
}

function Customer( $name, $l_name , $company , $tel_job , $tel_home , $tel_mobile , $email , $zipcode , $address , $comment , $id_ostan , $id_shahr)
{
$this->CustomerQuery = "name=$name"
."&l_name=$l_name"
."&company=$company"
."&tel_job=$tel_job"
."&tel_home=$tel_home"
."&tel_mobile=$tel_mobile"
."&email=$email"
."&zipcode=$zipcode"
."&address=$address"
."&comment=$comment"
."&id_shahr=$id_shahr"
."&id_ostan=$id_ostan";
}

function GetSendPrice() // 0 --> pishtaz , 1 --> sefareshi , 2 --> payk motori
{
$GetString=curl_init();
$params="Username=$this->Username"
."&Password=$this->Password";

$params.="&ProductSumPrice=$this->ProductSumPrice"
."&ProductSumWeight=$this->ProductSumWeight"
."&SendType=$this->SendType";

curl_setopt ( $GetString , CURLOPT_URL, "http://30ds.com/Webservice/?SendPrice");
curl_setopt ( $GetString, CURLOPT_POST, 1);
curl_setopt ( $GetString, CURLOPT_POSTFIELDS, $params);
curl_setopt ( $GetString, CURLOPT_RETURNTRANSFER, 1);
$this->SendPrice = curl_exec($GetString);
curl_close ( $GetString );
return $this->SendPrice;
}

function SendCard()
{
$GetString=curl_init();

$params="Username=$this->Username"
."&Password=$this->Password"
."&SendType=$this->SendType"
."&ProductsQuery=$this->ProductsQuery"
."&$this->CustomerQuery";

curl_setopt ( $GetString , CURLOPT_URL, "$this->URL?Card");
curl_setopt ( $GetString, CURLOPT_POST, 1);
curl_setopt ( $GetString, CURLOPT_POSTFIELDS, $params);
curl_setopt ( $GetString, CURLOPT_RETURNTRANSFER, 1);
$this->FactorKey = curl_exec($GetString);
curl_close ( $GetString );
return $this->FactorKey;
}
}

mojtaba-saleh
سه شنبه 17 اردیبهشت 1387, 22:27 عصر
اگه کنترل پنلتون از نوع پلسک باشه از مدیر هاستتون بخواید ماژوله PHP رو روی اون اگه نصب نیست, نصب کنه فایل های php هم قابل اجرا می شند

مهدی کرامتی
چهارشنبه 18 اردیبهشت 1387, 01:53 صبح
این سرویسی که اون همکارتون بهتون داده مبتنی بر Soap Web Service ها و استاندارد نیست، بلکه با پاس کردن یک سری پارامتر به یک URL کار میکنه. بنظر میاد سوادشون خیلی ابتدایی بوده.

milad7888
دوشنبه 17 خرداد 1389, 15:40 عصر
سلام
من مي خوام از طريق وب سايتم که به زبان ASP نوشته شده ، از وب سرويس يه سايت ديگه که PHP هستش استفاده کنم . به چه روشي ميتونم اين کار رو انجام بدم ؟
نمونه کدي که شرکت وب سرويس داره اينجوريه :



$option=array('login'=> "PanelUsername",'password'=> "WebServicePassword");
$client = new SoapClient("http://www.webimc.info/Webservice/wsdl.php",$option);
try{
$response = $client->GetSendPrice(30000,200,51,8,0);
$response = $client->RegisterOrder( "man" , "human" , "05111234567" , "05117654321" , "1234567" , "123456789" , "human@example.com" , "56789" , "mashhad" , "hello" ,"41" ,"14" ,"49^Windows Vista Home Edition^25000^100^1" , 0 );
echo $response;
}
catch (SoapFault $sf) {
echo $sf->faultcode."\n";
echo $sf->faultstring."\n";
}

M.mojaddady@gmail.com
یک شنبه 18 تیر 1391, 09:34 صبح
آقای Peysab (http://barnamenevis.org/member.php?85-Peysab) تونستی جوابی بگیری؟
منم همین مشکل رو با وب سرویس mihannic دارم. نمی دونم چطور تو .net ازش استفاده می شه کرد.
کسی از دوستان اگه راهنمایی کنه خیلی خوب می شه.
ممنون