Ejemplo n.º 1
0
$address_id = '';
$address_string = '123 Some Street, San Francisco, CA 94114';
$customer_email = '*****@*****.**';
$device_id = 'none';
$account_id = '0123456789';
$first_name = '';
$last_name = '';
$phone_number = '5101234567';
$description = 'No description provided.';
$media_url = '';
try {
    if (isset($_FILES['fileupload']) && $_FILES['fileupload']['name'] != '') {
        include 'fileUpload.php';
    }
    // Create a new instance of the Open 311 class.
    $open311 = new sf311(BASE_URL, API_KEY, CITY_ID);
    if (isset($_REQUEST['email'])) {
        $customer_email = $_REQUEST['email'];
    }
    if (isset($_REQUEST['fullname'])) {
        $fullname = split(" ", $_REQUEST['fullname']);
        $first_name = $fullname[0];
        $last_name = $fullname[count($fullname) - 1];
    }
    if (isset($_REQUEST['phone'])) {
        $phone_number = str_replace(" ", "", $_REQUEST['phone']);
    }
    if (isset($_REQUEST['description'])) {
        $description = $_REQUEST['description'];
    }
    if (isset($_REQUEST['selected_address'])) {
Ejemplo n.º 2
0
   Copyright 2010 Department of Technology, City and County of San Francisco.
   Redistribution and use in source and binary forms, with or without
   modification, are permitted under certain conditions; see the file
   COPYING for details.
****/
/**
* Usage example: Get a list of 311 services.
*/
// Include the Open 311 classes.
include_once 'classes/sf311.php';
define("SERVICELIST_URL", "");
define("API_KEY", "");
define("CITY_ID", "");
try {
    // Create a new instance of the Open 311 class.
    $open311 = new sf311(SERVICELIST_URL, API_KEY, CITY_ID);
    // Get a list of service types and descriptions.
    $open311->selectService();
    $serviceTypesXML = new SimpleXMLElement($open311->getOutput());
    // Check to see if an error code and message were returned.
    if (strlen($serviceTypesXML->Open311Error->errorCode) > 0) {
        throw new service_listException("API Error message returned: " . $serviceTypesXML->Open311Error->errorDescription);
    }
    // Loop through each service type and write out the code, name and description.
    // Construct an array for later use
    foreach ($serviceTypesXML->service as $service) {
        //echo $service->service_code.": ".$service->service_name.": ".$service->description."<br />";
        array_push($service_list, $service);
    }
} catch (service_listException $ex) {
    //die("ERROR: ".$ex->getMessage());