PHP Classes

File: client.php

Recommend this page to a friend!
  Classes of jeffrey Afable   Simple REST Server   client.php   Download  
File: client.php
Role: Example script
Content type: text/plain
Description: Sample for the client class
Class: Simple REST Server
Implement REST based Web services
Author: By
Last change:
Date: 12 years ago
Size: 628 bytes
 

Contents

Class file image Download
<?php
require("simple_restclient.php");


$uid = "user1"; # USERNAME FOR THE CONNECTION
$pwd = "pass1"; # PASSWORD FOR THE CONNECTION
$client =new RESTClient("http://localhost:233/REST/server.php");
$client->SetClass("Greetings");
$val = array('var1'=>'jeff','var2'=>'hi'); # ARGUMENTS THAT WILL BE PASSED FOR THE METHOD
if($client->Service_Exists()){ # CHECK IF THE SERVICE EXISTS
   
$client->SetAuth($uid, $pwd); # AUTHENTICATE THE CONNECTION
   
$client->Call->Method("Morning",$val,$return); # CALLING THE METHOD class->Morning('jeff','hi').
   
print $return;
}else{
    print
"Service not available for $url!";
}
?>