mirror of
https://github.com/curl/curl.git
synced 2026-07-03 20:27:15 +03:00
PHP examples
This commit is contained in:
parent
96f81a5c4a
commit
6f3bccd911
3 changed files with 35 additions and 0 deletions
10
php/examples/getpageinvar.php
Normal file
10
php/examples/getpageinvar.php
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# The PHP curl module supports the received page to be returned in a variable
|
||||
# if told.
|
||||
#
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL,"http://www.myurl.com/");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
|
||||
$result=curl_exec ($ch);
|
||||
curl_close ($ch);
|
||||
13
php/examples/simpleget.php
Normal file
13
php/examples/simpleget.php
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#
|
||||
# A very simple example that gets a HTTP page.
|
||||
#
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt ($ch, CURLOPT_URL, "http://www.zend.com/");
|
||||
curl_setopt ($ch, CURLOPT_HEADER, 0);
|
||||
|
||||
curl_exec ($ch);
|
||||
|
||||
curl_close ($ch);
|
||||
|
||||
12
php/examples/simplepost.php
Normal file
12
php/examples/simplepost.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# A very simple PHP example that sends a HTTP POST to a remote site
|
||||
#
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.phtml");
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, "postvar1=value1&postvar2=value2&postvar3=value3");
|
||||
|
||||
curl_exec ($ch);
|
||||
curl_close ($ch);
|
||||
Loading…
Add table
Add a link
Reference in a new issue