Welcome to mirror list, hosted at ThFree Co, Russian Federation.

demo_12.php « examples - github.com/hxseven/htmlSQL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 68d524a9b3dbff153ff8caf4ac266feb31bdc3cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);
        
    }
    
?>