CURL_SHARE_INIT(3) 1 CURL_SHARE_INIT(3)curl_share_init - Initialize a cURL share handleSYNOPSIS
resource curl_share_init (void )
DESCRIPTION
Allows to share data between cURL handles.
PARAMETERS
This function has no parameters.
RETURN VALUES
Returns resource of type "cURL Share Handle".
EXAMPLES
Example #1
curl_share_init(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_setopt(3), curl_share_close(3).
PHP Documentation Group CURL_SHARE_INIT(3)
Check Out this Related Man Page
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)
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)
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)