diff options
author | Jonas John <jonas@jonasjohn.de> | 2012-02-09 13:42:59 +0400 |
---|---|---|
committer | Jonas John <jonas@jonasjohn.de> | 2012-02-09 13:42:59 +0400 |
commit | a44eee9e97a7851596e26de2c9e53fa569df7389 (patch) | |
tree | 27904364de31aad4ddfab8bc006261fc6a382382 /examples/demo_12.php |
Initial commit (version 0.5 of May 2006)
Diffstat (limited to 'examples/demo_12.php')
-rwxr-xr-x | examples/demo_12.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/examples/demo_12.php b/examples/demo_12.php new file mode 100755 index 0000000..68d524a --- /dev/null +++ b/examples/demo_12.php @@ -0,0 +1,44 @@ +<?php
+
+ /*
+ ** htmlSQL - Example 12
+ **
+ ** Shows how to replace the user agent and the referer with
+ ** custom values
+ */
+
+ include_once("../snoopy.class.php");
+ include_once("../htmlsql.class.php");
+
+ $wsql = new htmlsql();
+
+ // set a individual agent:
+ $wsql->set_user_agent('MyAgentName/0.9');
+
+ // set a new referer:
+ $wsql->set_referer('http://www.jonasjohn.de/custom/referer/');
+
+
+ // connect to a URL
+ if (!$wsql->connect('url', 'http://codedump.jonasjohn.de/')){
+ print 'Error while connecting: ' . $wsql->error;
+ exit;
+ }
+
+ /* execute a query:
+
+ This query returns all links:
+ */
+ if (!$wsql->query('SELECT * FROM a')){
+ print "Query error: " . $wsql->error;
+ exit;
+ }
+
+ // fetch results as array
+ foreach($wsql->fetch_array() as $row){
+
+ print_r($row);
+
+ }
+
+?>
\ No newline at end of file |