CURL_INIT(3) 1 CURL_INIT(3)curl_init - Initialize a cURL sessionSYNOPSIS
resource curl_init NULL ([string $url])
DESCRIPTION
Initializes a new session and return a cURL handle for use with the curl_setopt(3), curl_exec(3), and curl_close(3) functions.
PARAMETERS
o $url
- If provided, the CURLOPT_URL option will be set to its value. You can manually set this using the curl_setopt(3) function.
Note
The file protocol is disabled by cURL if open_basedir is set.
RETURN VALUES
Returns a cURL handle on success, FALSE on errors.
EXAMPLES
Example #1
Initializing a new cURL session and fetching a web page
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, 0);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
SEE ALSO curl_close(3), curl_multi_init(3).
PHP Documentation Group CURL_INIT(3)
Check Out this Related Man Page
CURL_MULTI_ADD_HANDLE(3) 1 CURL_MULTI_ADD_HANDLE(3)curl_multi_add_handle - Add a normal cURL handle to a cURL multi handleSYNOPSIS
int curl_multi_add_handle (resource $mh, resource $ch)
DESCRIPTION
Adds the $ch handle to the multi handle $mh
PARAMETERS
o $mh
-A cURL multi handle returned by curl_multi_init(3).
o $ch
-A cURL handle returned by curl_init(3).
RETURN VALUES
Returns 0 on success, or one of the CURLM_XXX errors code.
EXAMPLES
Example #1
curl_multi_add_handle(3) example
This example will create two cURL handles, add them to a multi handle, and process them asynchronously.
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// set URL and other appropriate options
curl_setopt($ch1, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch2, CURLOPT_HEADER, 0);
//create the multiple cURL handle
$mh = curl_multi_init();
//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
$running=null;
//execute the handles
do {
curl_multi_exec($mh,$running);
} while($running > 0);
//close all the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
SEE ALSO curl_multi_remove_handle(3), curl_multi_init(3), curl_init(3).
PHP Documentation Group CURL_MULTI_ADD_HANDLE(3)
Has anyone who is running linux-apache-mysql-php (LAMP) ever upgraded their PHP configuration (in a working environment) to support cURL?
If you have, please post the easiest way to do it without adversely effecting the other parts of the LAMP configuration.
Thanks! (1 Reply)
--fail seems to not be working in cURL. When using cURL to download multiple files, --fail is supposed to keep cURL from making files that don't exist, on 404 errors. But when I use --fail or -f, it still makes those files. I've tried it on both Cygwin cURL and Win32 cURL.
Anyone know anything... (2 Replies)
is there a command that allows you to take a url and grab the source code from the page and output it to stdout?
i want to know because i want to grab a page and pass it thru another program to analyze the page.
any help would be appreciated
thanks (3 Replies)
I have a CGI application done in c++ that communicates with PayPal. I've had an issue where the application dies when I try to perform a cURL operation. Upon further inspection it seems that I can run cURL examples from the command line.
Upon even further inspection it seems that I can run... (8 Replies)
This is about to drive me crazy. What I want to do is simple:
output ALL the verbose information from curl to a file
I have read the manual, tried several options and searched this forum but no salvation...
I'm using
curl -k -Q "command" --user user:passwd --ftp-pasv --ftp-ssl -v... (1 Reply)
I am having trouble logging in to an account via cURL in the terminal. I need to be able to log in to this page then get a query result from another. I need to do this as a shell script all at once.
Im not sure how to handle cookies with terminal & have found very little example.
curl ... (1 Reply)
hi
please help me out here,
i want to use curl command in shell script to test web pages,
what i have is an opening page, when i click on a button on opening page, the next page comes up and then i have to upload a file n then click another button to submit and then comes the output page,... (2 Replies)
I have a spent a day with Google trying to figure this one out and have decided its time to ask the experts...
I'm running OS X 10.6
I need to use cURL to FTP a file.
I have been successful send the file from the command line when I know the filename. My problem is that the filename changes... (2 Replies)
hi!! this is my first post!! our university student search has this form which uses POST method(the website is swd.bits-goa.ac.in/searchform1)..now i tried sending post data from cURL...
curl -o this.html --data "name=rohan&id=&hostel=&room=&branch=&search=Search"... (9 Replies)
Hello unix.com
I want to use curl to post some logs to a remote server using curl.
$ch = curl_init("http://example.com/post/post.php");
curl_setopt($ch, CURLOPT_POST ,1);
curl_setopt($ch, CURLOPT_POSTFIELDS ,"FOUT=hash.gif&DATA=$message");
curl_setopt($ch, CURLOPT_HEADER ... (4 Replies)
Hello,
I want to add open_basedir line for exiting hosts.
all web site configurations located on /etc/httpd/conf.d
and file name format : vhost_example.com
I want to add this line
php_admin_value open_basedir "/chroot/home/$UNIXNAME/:/usr/share/pear/:/tmp/:/var/lib/php/session/"
... (1 Reply)
Hi,
I am currently in the process of creating a script that will use cURL to HTTP POST the contents of a file on the server.
I am able to run the command;
curl -d @/path/to/file/filename.dat "https://posting.server.com/test.aspx"to post a single file and this works as expected.
The... (4 Replies)
I am trying to write a shell script to use curl in order to automate downloading data from a website. The URL with the post form is here: http://try-db.org/de/InfoBySpecies.php .
I have a list of about 1800 different species I want to check. For Example, choose the first species and use the... (2 Replies)
Hi,
I've got a project to write a C++ code to open a webpage,read the content and write it in a file. I'm using cURL and compiling the code using G++ in unix. I'm getting compilation error as: "cURL.h: no file or directory".
Can some one please tell me how to install/link this library in... (3 Replies)
This question could be specific to the site subdivx.com In the past, I've been able to download a file following location using cURL but there is something about subdivx.com that's different and can't figure out how to get it to work.
I tried the following directly in the terminal with no... (5 Replies)