Peysab
سه شنبه 17 اردیبهشت 1387, 14: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;
}
}
<?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;
}
}