Skip to content

Instantly share code, notes, and snippets.

View jamesmills's full-sized avatar

James Mills jamesmills

View GitHub Profile
@jamesmills
jamesmills / gist:5748138
Created June 10, 2013 11:34
Get curl header
<?php
$ch = curl_init('http://cts-web-api.cloudapp.net/api/hotels?destination=mgm');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Range: items=1-5'));
$response = curl_exec($ch);
@jamesmills
jamesmills / tour_booking_details.php
Last active December 11, 2015 05:48
Travel Editions Test
<?php
include('inc/functions.php');
$myTourOS = new TourOs();
// Get a new session from Tours API and store it in out own session to use it again
$_SESSION['tourOsToken'] = (string)$myTourOS->getSession();
output($_SESSION['tourOsToken'], 'tourOsToken');
// get the detials of the departure sending our own session and the ID sent in the URI
@jamesmills
jamesmills / index.php
Created December 18, 2012 13:04
Tour Offer Title
$content = new SimpleXMLElement(file_get_contents('http://www.traveleditions.co.uk/service.asmx/ReturnTours'));
foreach ($content->Tours->Tour as $tour) {
if ($tour->Country['Name'] == 'United Kingdom') {
echo '<p>' . htmlentities($tour->OfferTitle, ENT_QUOTES | ENT_IGNORE, "UTF-8") . '</p>';
}
}
@jamesmills
jamesmills / gist:3930151
Created October 22, 2012 07:38
geolocation
<script type="text/javascript" charset="utf-8">
<!--
function findLocation()
{
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
}
function foundLocation(position)
{
@jamesmills
jamesmills / gist:3667389
Created September 7, 2012 15:57
Tesco API - Issue 1
There is an error with the response from the CHANGEBASKET function.
Sending
http://www.techfortesco.com/groceryapi/restservice.aspx?COMMAND=CHANGEBASKET&PRODUCTID=5556666777788888&CHANGEQUANTITY=1&SESSIONKEY={sessionKey}
Should not return
{ "StatusCode": 0, "StatusInfo": "Basket change completed successfully" }