Beispiel #1
0
 public function VerifyToken(AuthInfo $authinfo)
 {
     $headers = array('Content-Type' => 'application/json', 'Authorization' => $authinfo->_token_type . ' ' . $authinfo->_id_token);
     $request = new Http_Request2('https://merchant-api.jet.com/api/authcheck/');
     $request->setMethod(HTTP_Request2::METHOD_GET);
     $request->setHeader($headers);
     $request->setBody("");
     $request->setConfig(array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE));
     try {
         $response = $request->send();
         //echo $response->getBody();
         $bodyresponse = $response->getBody();
         //$jsonresp = json_decode($bodyresponse);
         return true;
     } catch (HttpException $ex) {
         echo $ex;
         return false;
     }
 }
Beispiel #2
0
 public function PutOrderComplete(AuthInfo $authinfo, $id, $ordeerdetails)
 {
     $headers = array('Content-Type' => 'application/json', 'Authorization' => $authinfo->_token_type . ' ' . $authinfo->_id_token);
     $request = new Http_Request2('https://merchant-api.jet.com/api/returns/' . $id . '/complete');
     $request->setMethod(HTTP_Request2::METHOD_PUT);
     $request->setHeader($headers);
     $bodycontent = json_encode($ordeerdetails);
     $request->setBody($bodycontent);
     $request->setConfig(array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE));
     try {
         $response = $request->send();
         //echo $response->getBody();
         $bodyresponse = $response->getBody();
         $jsonresp = $bodyresponse;
         return $jsonresp;
     } catch (HttpException $ex) {
         echo $ex;
         return null;
     }
 }
Beispiel #3
0
 public function GetTaxonomyNodeAttributes(AuthInfo $authinfo, $nodeid)
 {
     $headers = array('Content-Type' => 'application/json', 'Authorization' => $authinfo->_token_type . ' ' . $authinfo->_id_token);
     $request = new Http_Request2('https://merchant-api.jet.com/api/taxonomy/nodes/' . $nodeid . '/attributes');
     $request->setMethod(HTTP_Request2::METHOD_GET);
     $request->setHeader($headers);
     $request->setBody("");
     $request->setConfig(array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE));
     try {
         $response = $request->send();
         echo $response->getBody();
         $bodyresponse = $response->getBody();
         $jsonresp = json_decode($bodyresponse);
         //if( stripos($bodyresponse, 'iphone'  ) ){
         //    echo 'found iphone';
         //}
         return $jsonresp;
     } catch (HttpException $ex) {
         echo 'Exception caught : ' . $ex;
         return null;
     }
 }
<?php

require_once 'HTTP/Request2.php';
require_once 'AuthAPI.php';
require_once 'TaxonomyAPI.php';
require_once 'ProductAPI.php';
require_once 'OrdersAPI.php';
require_once 'ReturnAPI.php';
$request = new Http_Request2('https://merchant-api.jet.com/api/token/');
$request->setMethod(HTTP_Request2::METHOD_POST);
$headers = array('Content-Type' => 'application/json');
$request->setHeader($headers);
$bodyvalue = '{
  "user": "******",
  "pass": "******"
}';
$request->setBody($bodyvalue);
$request->setConfig(array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE));
try {
    //var_dump($request);
    $response = $request->send();
    echo 'success' . $response->getBody();
} catch (HttpException $ex) {
    echo 'in exception';
    echo $ex;
}
Beispiel #5
0
             echo '<rs/>';
             ob_end_flush();
             ob_flush();
             flush();
             ob_start();
             break;
         }
     }
     echo '<rs/>';
     ob_end_flush();
     ob_flush();
     flush();
     ob_start();
 }
 $r = new Http_Request2('https://collegedb2.ferryfair.com/lib/signOut.php');
 $r->setConfig(array("ssl_verify_peer" => FALSE, "ssl_local_cert" => "{$root}/ssl/collegedb2.ferryfair.com.cert"));
 $r->setMethod(HTTP_Request2::METHOD_POST);
 $r->addPostParameter(array('SESSION_ID' => $sessionId));
 //$r->addCookie('PHPSESSID', 'bkq0t2vf2n9898t4q83jje7bp7');
 //$r->addCookie('XDEBUG_SESSION', 'netbeans-xdebug');
 try {
     $response = $r->send();
 } catch (Exception $exc) {
     $es = $exc->getTraceAsString();
     $response = NULL;
 }
 $body = $response->getBody();
 if (strpos($body, "<status>signedOut</status>") >= 0) {
     echo json_encode(array('status' => 'I, dataGrabber.php finished my job ~:)~'));
 } else {
     echo json_encode(array('status' => 'I, dataGrabber.php unable to signOut from the ferry ~:|~'));
Beispiel #6
0
 public function DeleteSKU(AuthInfo $authinfo, $sku, $oneprod)
 {
     $headers = array('Content-Type' => 'application/json', 'Authorization' => $authinfo->_token_type . ' ' . $authinfo->_id_token);
     $request = new Http_Request2('https://merchant-api.jet.com/api/merchant-skus/' . $sku . '/image');
     $request->setMethod(HTTP_Request2::METHOD_DELETE);
     $request->setHeader($headers);
     $bodycontent = "";
     $request->setBody($bodycontent);
     $request->setConfig(array('ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE));
     try {
         $response = $request->send();
         //echo $response->getBody();
         $bodyresponse = $response->getBody();
         $jsonresp = $bodyresponse;
         return $jsonresp;
     } catch (HttpException $ex) {
         echo $ex;
         return null;
     }
 }