PHP Classes

File: test1.php

Recommend this page to a friend!
  Classes of Orazio Principe   Italian Cities and Postal Code checker   test1.php   Download  
File: test1.php
Role: Example script
Content type: text/plain
Description: Test file
Class: Italian Cities and Postal Code checker
Search Italian cities, postal codes and addresses
Author: By
Last change:
Date: 7 years ago
Size: 985 bytes
 

Contents

Class file image Download
<?php
/**
 * Owner: Principe Orazio
 * Date: 20/05/16
 * Time: 09:20
 *
 * Test file for ItalianCities class
 */
require_once ("ItalianCities.php");

$ic = new ItalianCites();

//Just for this example we can get max. 2 records for each call
$records = 2;

//Search by city
$city = "Roma";
$results = $ic->getCurlResults($city,null,null,$records);
var_dump($results);

echo
"<hr>";

//Search by postalCode
$postalCode = "01034";
$results = $ic->getCurlResults(null,null,$postalCode,$records);
var_dump($results);

echo
"<hr>";

//Search by city and address
$city = "Roma";
$address = "Via Aurelia";
$results = $ic->getCurlResults($city,$address,null,$records);
var_dump($results);

echo
"<hr>";

//Test city and cap -> correct
$city = "Roma";
$postalCode = "00199";
$results = $ic->verify($city,null,$postalCode);
var_dump($results);


echo
"<hr>";

//Test city and cap -> wrong
$city = "Roma";
$postalCode = "10100";
$results = $ic->verify($city,null,$postalCode);
var_dump($results);