1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- set_include_path(
- get_include_path().PATH_SEPARATOR
- .'zend-framework/'
- );
- require_once('../phpQuery/phpQuery.php');
- phpQuery::$debug = true;
- phpQuery::$ajaxAllowedHosts[] = 'wikipedia.org';
- phpQuery::$ajaxAllowedHosts[] = 'google.com';
- phpQuery::$ajaxAllowedHosts[] = 'code.google.com';
- phpQuery::$ajaxAllowedHosts[] = 'www.google.com';
- $testName = 'Load';
- $test = phpQuery::newDocumentFile('test.html')
- ->find('div:first')
- ->load('http://wikipedia.org/ div[lang]');
- if (pq('div[lang]')->size())
- print "Test '$testName' PASSED :)";
- else {
- print "Test '$testName' <strong>FAILED</strong> !!! ";
- print "<pre>";
- print "</pre>\n";
- }
- print "\n";
- $pq = phpQuery::ajax(array(
- 'url' => 'http://'.$_SERVER['SERVER_NAME'].preg_replace('@/[^/]+$@', '/test_ajax_data_1', $_SERVER['REQUEST_URI']),
- 'success' => 'a789fhasdui3124',
- 'error' => 'jhdbg786213u8dsfg7y'
- ));
- function a789fhasdui3124($html) {
- $testName = 'AJAX request text node';
- if ( $html == 'hello world' )
- print "Test '$testName' PASSED :)";
- else {
- print "Test '$testName' <strong>FAILED</strong> !!! ";
- }
- print "\n";
- }
- function jhdbg786213u8dsfg7y() {
- $testName = 'AJAX request text node';
- print "Test '$testName' <strong>FAILED</strong> !!! ";
- }
|