Example #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;
     }
 }
Example #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;
     }
 }
 public function Analyze()
 {
     $imageURL = $this->ImageURL;
     // This sample uses the HTTP_Request2 package. (for more information: http://pear.php.net/package/HTTP_Request2)
     require_once 'HTTP/Request2.php';
     $headers = array('Content-Type' => 'application/json');
     $query_params = array('subscription-key' => 'f2967b0e51bc4c848838814ae877780e', 'visualFeatures' => 'Categories, Description');
     $request = new Http_Request2('https://api.projectoxford.ai/vision/v1/analyses');
     $request->setMethod(HTTP_Request2::METHOD_POST);
     // Basic Authorization Sample
     // $request-setAuth('{username}', '{password}');
     $request->setHeader($headers);
     $url = $request->getUrl();
     $url->setQueryVariables($query_params);
     $request->setBody("{'Url':'{$imageURL}'}");
     try {
         $response = $request->send();
         return $response->getBody();
     } catch (HttpException $ex) {
         return false;
     }
 }
Example #4
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;
     }
 }
Example #5
0
    } else {
        echo "Upload: " . $_FILES["file"]["name"] . "<br />";
        echo "Type: " . $_FILES["file"]["type"] . "<br />";
        echo "Size: " . $_FILES["file"]["size"] / 1024 . " Kb<br />";
        echo "Stored in: " . $_FILES["file"]["tmp_name"] . " <br />";
    }
} else {
    echo "Invalid file <br />";
}
echo "---test emotion api from here---<br />";
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://api.projectoxford.ai/emotion/v1.0/recognize');
$url = $request->getUrl();
$headers = array('Content-Type' => 'application/octet-stream', 'Ocp-Apim-Subscription-Key' => '2607f8062fb3451e84de25a087b7d2e3');
$request->setHeader($headers);
/*
$parameters = array(
    // Request parameters
    //'faceRectangles' => '{string}',
);

$url->setQueryVariables($parameters);
*/
$request->setMethod(HTTP_Request2::METHOD_POST);
// Request body
$request->setBody(fopen($_FILES["file"]["tmp_name"], 'r'));
echo $request->getBody() . "<br/> item upon is request body<br/>";
try {
    $response = $request->send();
    echo $response->getBody() . "<br/> item upon is response body<br/>";
Example #6
0
<?php

//Author: satya gowtham kudupudi
//Time: 2012-03-04 13:08:00
require 'HTTP/Request2.php';
$url = 'http://mail.ferryfair.com/PHPWebAdmin/index.php';
$r = new Http_Request2($url);
$r->setMethod(HTTP_Request2::METHOD_POST);
$r->setHeader(array("Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "Accept-Charset" => "ISO-8859-1,utf-8;q=0.7,*;q=0.3", "Accept-Encoding" => "gzip,deflate,sdch", "Accept-Language" => "en-US,en;q=0.8,te;q=0.6", "Cache-Control" => "max-age=0", "Connection" => "keep-alive", "Content-Length" => "355", "Content-Type" => "application/x-www-form-urlencoded"));
$r->addPostParameter(array('page' => 'background_account_save', 'action' => 'edit', 'domainid' => '1', 'accountid' => '12', 'accountaddress' => 'capt.roja', 'accountpassword' => 'g2wjzxx1NXDeujPW', 'accountmaxsize' => '100', 'accountadminlevel' => '0', 'accountactive' => '1', 'vacationsubject' => '', 'vacationmessage' => '', 'vacationmessageexpiresdate' => '2012-03-04', 'forwardaddress' => '', 'SignaturePlainText' => '', 'SignatureHTML' => '', 'addomain' => '', 'adusername' => '', 'PersonFirstName' => '', 'PersonLastName' => ''));
$r->send();
$page = $r->getBody();
print_r($page);
 private function post_to_twitter($resp_data)
 {
     if ($this->format == 'json') {
         $data = json_decode($resp_data);
     } elseif ($this->format == 'xml') {
         $data = simplexml_load_string($resp_data);
     }
     $tweet = $this->truncate((string) $data->text) . ' ' . (string) $data->url;
     $header = $this->build_header($tweet);
     $url = "http://api.twitter.com/1/statuses/update.{$this->format}";
     $r = new Http_Request2($url, Http_Request2::METHOD_POST);
     $r->setHeader('Authorization', $header);
     $r->addPostParameter('status', $tweet);
     $res = $r->send();
     if ($res->getStatus() == 200) {
         return $this->respond($resp_data);
     } else {
         throw new TwitPicAPIException("Image uploaded, but error posting to Twitter");
     }
 }
Example #8
0
     $es = $exc->getTraceAsString();
     $response = null;
 }
 $body = $response->getBody();
 if (strpos($body, "authorization:'*'")) {
     header('Content-Type: application/octet-stream');
     $fetchErrCount = 0;
     foreach ($_SESSION['grbr'][$dbTable]['objs'] as $key => $value) {
         $oid = trim($value, 'o');
         $query = "SELECT * FROM `objectTable` WHERE `index`=" . $oid;
         $result = mysql_db_query('collegedb2admin', $query, $dbc);
         $id = mysql_result($result, 0, 'id');
         $url = $qurl . $id;
         $r = new Http_Request2($url);
         $r->setMethod(HTTP_Request2::METHOD_GET);
         $r->setHeader(array("Referer" => $srcurl, "User-Agent" => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.4 (KHTML, like Gecko) Chrome/19.0.1077.3 Safari/536.4"));
         $r->addCookie('__utma', '264667532.627952658.1331704468.1331704468.1331704468.1');
         $r->addCookie('__utmc', '264667532');
         $r->addCookie('__utmz', '264667532.1331704468.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)');
         $r->addCookie('__utmb', '264667532');
         try {
             $response = $r->send();
         } catch (Exception $exc) {
             $es = $exc->getTraceAsString();
             $response = null;
         }
         if ($response) {
             $page = $response->getBody();
             $dom = new DOMDocument();
             $dom->loadHTML($page);
             $xp = new DOMXPath($dom);
Example #9
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;
     }
 }
Example #10
0
 $result = mysql_query($query, $dbc);
 $error3 = mysql_error($dbc);
 if (!$error3) {
     $mkdir = mkdir('../../userFiles/' . $usrname);
     $fhandler = fopen('../../userFiles/' . $usrname . '/live.shm', 'w');
     fclose($fhandler);
     $photo_id = $_POST['photoID'];
     if (copy('../../tmp/' . $photo_id, '../../userFiles/' . $usrname . '/' . $photo_id)) {
         unlink('../../tmp/' . $photo_id);
     }
     // Connect to hMailServer
     require 'HTTP/Request2.php';
     $url = 'http://mail.ferryfair.com/PHPWebAdmin/standardAccountCreator.php';
     $r = new Http_Request2($url);
     $r->setMethod(HTTP_Request2::METHOD_POST);
     $r->setHeader(array("Content-Type" => "application/x-www-form-urlencoded"));
     $r->addPostParameter(array('username' => $usrname, 'ePass' => $ePass, 'fullName' => $_POST['fullName']));
     $r->addCookie('PHPSESSID', 'bkq0t2vf2n9898t4q83jje7bp7');
     $r->addCookie('XDEBUG_SESSION', 'netbeans-xdebug');
     $response = $r->send();
     $page = $response->getBody();
     $dd = new DOMDocument();
     $dd->loadXML($page);
     $st = innerHTML($dd->getElementsByTagName('status')->item(0));
     $accountId = innerHTML($dd->getElementsByTagName('accountId')->item(0));
     if ($mkdir && $accountId) {
         $key = ftok('../../userFiles/' . $usrname . '/live.shm', 'c');
         $shmId = shm_attach($key);
         $user['status'] = 0;
         $user['nickName'] = trim($nickName, "'");
         $user['username'] = $usrname;
Example #11
0
<?php

/* Author: Gowtham */
require 'HTTP/Request2.php';
$url = 'http://www.results.manabadi.co.in/KJNTUBTECH11012012.aspx?htno=06331a0478';
$r = new Http_Request2($url);
$r->setMethod(HTTP_Request2::METHOD_GET);
$r->setHeader(array("Referer" => "http://www.results.manabadi.co.in/KakinadaJNTU-IIIB.Tech-IIsem-results-11012012.htm"));
$r->addCookie('__utma', '264667532.627952658.1331704468.1331704468.1331704468.1');
$r->addCookie('__utmc', '264667532');
$r->addCookie('__utmz', '264667532.1331704468.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)');
$r->addCookie('__utmb', '264667532');
//$response = $r->send();
//$page = $response->getBody();
$dom = new DOMDocument();
$page = "<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN' 'http://www.w3.org/TR/REC-html40/loose.dtd'><html><body><br><table width='80%' cellpadding='0' cellspacing='0'><tr><th colspan='2' align='center'>Personal Information</th></tr><tr><td><b> Hall Ticket No </b></td><td>06331A0478</td></tr></table><br><table width='100%' cellpadding='0' cellspacing='0'><tr><th colspan='5' align='center'>Marks Details</th></tr><tr><td><b>Subject Code</b></td><td><b>Subject Name</b></td><td><b>Internal Marks</b></td><td><b>External Marks</b></td><td><b>Credits</b></td></tr><tr><td>Q0403</td><td>MICROWAVE ENGG.</td><td>9</td><td>14</td><td>0</td></tr></table><br><br></body></html>";
$dom->loadHTML($page);
$xp = new DOMXPath($dom);
///html/body/table/tbody/tr[td='Subject Code']/ancestor::tbody/tr
$result = $xp->query("/html/body/table/tr[td='Subject Code']/ancestor::table/tr");
$i = 2;
echo '<subs>';
while ($elm = $result->item($i)) {
    $r = $xp->query("td[1]/text()", $elm);
    echo '<sub><subcode>' . $r->item(0)->C14N() . '</subcode>';
    $r = $xp->query("td[2]/text()", $elm);
    echo '<subname>' . $r->item(0)->C14N() . '</subname></sub>';
    $i++;
}
echo '</subs>';