X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2FHttpRequest_002.phpt;h=76e12a31dfef91458674b38110697fd97127641c;hp=52941506cb8ba1cdc5b43690adc1a9833a6787da;hb=c51384deca17beea51a6efdd82ac9efb551220eb;hpb=244c8484720c23fdb5d9d557ca180dc2b822a140 diff --git a/tests/HttpRequest_002.phpt b/tests/HttpRequest_002.phpt index 5294150..76e12a3 100644 --- a/tests/HttpRequest_002.phpt +++ b/tests/HttpRequest_002.phpt @@ -1,21 +1,34 @@ --TEST-- -HttpRequest GET +HttpRequest GET/POST --SKIPIF-- - (int) PHP_VERSION) and die('skip PHP5 is required for Http classes'); +checkver(5); +checkcls('HttpRequest'); +checkurl('www.google.com'); +checkurl('dev.iworks.at'); ?> --FILE-- send()); +echo "-TEST\n"; + +$r = new HttpRequest('http://www.google.com', HttpRequest::METH_GET); +$r->send(); print_r($r->getResponseInfo()); + +$r = new HttpRequest('http://dev.iworks.at/.print_request.php', HTTP_METH_POST); +$r->addCookies(array('MyCookie' => 'foobar')); +$r->addQueryData(array('gq'=>'foobar','gi'=>10)); +$r->addPostFields(array('pq'=>'foobar','pi'=>10)); +$r->addPostFile('upload', dirname(__FILE__).'/data.txt', 'text/plain'); +$r->send(); +echo $r->getResponseBody(); +var_dump($r->getResponseMessage()->getResponseCode()); + +echo "Done"; ?> --EXPECTF-- -Content-type: text/html -X-Powered-By: PHP/%s - -bool(true) +%sTEST Array ( [effective_url] => http://www.google.com/ @@ -40,6 +53,28 @@ Array [content_length_upload] => %d [content_type] => %s [httpauth_avail] => %d - [proxyauth_avail] => %d - [num_connects] => %d + [proxyauth_avail] => %s ) +Array +( + [gq] => foobar + [gi] => 10 + [pq] => foobar + [pi] => 10 + [MyCookie] => foobar +) +Array +( + [upload] => Array + ( + [name] => data.txt + [type] => text/plain + [tmp_name] => %s + [error] => 0 + [size] => 1010 + ) + +) + +int(200) +Done