CURL_SHARE_CLOSE(3) 1 CURL_SHARE_CLOSE(3)curl_share_close - Close a cURL share handleSYNOPSIS
void curl_share_close (resource $sh)
DESCRIPTION
Closes a cURL share handle and frees all resources.
PARAMETERS
o $sh
- A cURL share handle returned by curl_share_init(3)RETURN VALUES
No value is returned.
EXAMPLES
Example #1
curl_share_setopt(3) example
This example will create a cURL share handle, add two cURL handles to it, and then run them with cookie data sharing.
<?php
// Create cURL share handle and set it to share cookie data
$sh = curl_share_init();
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
// Initialize the first cURL handle and assign the share handle to it
$ch1 = curl_init("http://example.com/");
curl_setopt($ch1, CURLOPT_SHARE, $sh);
// Execute the first cURL handle
curl_exec($ch1);
// Initialize the second cURL handle and assign the share handle to it
$ch2 = curl_init("http://php.net/");
curl_setopt($ch2, CURLOPT_SHARE, $sh);
// Execute the second cURL handle
// all cookies from $ch1 handle are shared with $ch2 handle
curl_exec($ch2);
// Close the cURL share handle
curl_share_close($sh);
// Close the cURL handles
curl_close($ch1);
curl_close($ch2);
?>
SEE ALSO curl_share_init(3).
PHP Documentation Group CURL_SHARE_CLOSE(3)
Check Out this Related Man Page
CURL_MULTI_EXEC(3) 1 CURL_MULTI_EXEC(3)curl_multi_exec - Run the sub-connections of the current cURL handleSYNOPSIS
int curl_multi_exec (resource $mh, int &$still_running)
DESCRIPTION
Processes each of the handles in the stack. This method can be called whether or not a handle needs to read or write data.
PARAMETERS
o $mh
-A cURL multi handle returned by curl_multi_init(3).
o $still_running
- A reference to a flag to tell whether the operations are still running.
RETURN VALUES
A cURL code defined in the cURL Predefined Constants.
Note
This only returns errors regarding the whole multi stack. There might still have occurred problems on individual transfers even
when this function returns CURLM_OK.
EXAMPLES
Example #1
curl_multi_exec(3) example
This example will create two cURL handles, add them to a multi handle, and then run them in parallel.
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// set URL and other appropriate options
curl_setopt($ch1, CURLOPT_URL, "http://lxr.php.net/");
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);
$active = null;
//execute the handles
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
?>
SEE ALSO curl_multi_init(3), curl_multi_select(3), curl_exec(3).
PHP Documentation Group CURL_MULTI_EXEC(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)
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)
hi there !
i have exactly the same problem like this guy here
https://www.unix.com/shell-programming-scripting/127668-getting-curl-output-verbose-file.html
i am not able to save the curl verbose output..
the sollution in this thread (redirecting stderr to a file) does not work for me.... (0 Replies)
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)
Searched here and google and couldn't find a viable solution. Is there a way to transfer a file with curl and have it automatically attempt to resume it if there's an error, broken pipe, interruption, etc?
curl -C- -T myfile.tar.gz ftp.site.com --user DC_Slick:password That's what I use... (1 Reply)
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)
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)
Hello,
I'm new in the forum and really beginer, and also sorry form my bad english.
I use linux and want to create little program to download automaticaly some pdf (invoices) and put in a folder of my computer. I learn how to do and programme with ubuntu but the program will be implemented... (1 Reply)
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)