<?php
// Connect to the database
$conn = pg_pconnect("dbname=publisher");
// Execute a COPY
$result = pg_query($conn, "COPY authors FROM STDIN;");
// Get the result status
$status = pg_result_status($result);
// Determine status
if ($status == PGSQL_COPY_IN)
echo "Copy began.";
else
echo "Copy failed.";
?>
The above example will output: