curl_share_setopt

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

curl_share_setoptSet an option for a cURL share handle

Beschreibung

curl_share_setopt(CurlShareHandle $share_handle, int $option, mixed $value): bool

Sets an option on the given cURL share handle.

Parameter-Liste

share_handle

Ein gemeinsames cURL-Handle, das von curl_share_init() zurückgegeben wird.

option

Option Description
CURLSHOPT_SHARE Specifies a type of data that should be shared.
CURLSHOPT_UNSHARE Specifies a type of data that will be no longer shared.

value

Value Description
CURL_LOCK_DATA_COOKIE Shares cookie data.
CURL_LOCK_DATA_DNS Shares DNS cache. Note that when you use cURL multi handles, all handles added to the same multi handle will share DNS cache by default.
CURL_LOCK_DATA_SSL_SESSION Shares SSL session IDs, reducing the time spent on the SSL handshake when reconnecting to the same server. Note that SSL session IDs are reused within the same handle by default.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Changelog

Version Beschreibung
8.0.0 share_handle erwartet nun eine CurlShareHandle-Instanz; vorher wurde eine Ressource erwartet.

Beispiele

Beispiel #1 curl_share_setopt() 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($shCURLSHOPT_SHARECURL_LOCK_DATA_COOKIE);

// Initialize the first cURL handle and assign the share handle to it
$ch1 curl_init("http://example.com/");
curl_setopt($ch1CURLOPT_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($ch2CURLOPT_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);
?>

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

How Clean SQL Architecture Saves You From Technical Debt

Once I realized I could offload repeat logic to SQL views, my PHP Infinite Craft​ (https://infinitecraftrecipes.io) code started looking more li ...

Geschrieben von bekeanloinse56 am 20.05.2025 05:16:28
Forum: SQL / Datenbanken
Hilfe! Datenübertragung

genau wie Flavaslava schon gesagt hat: Du brauchst eine .php-Datei, die dein Formular ausliest und dann die Verbindung zur MySQL-Datenbank herstel ...

Geschrieben von bekeanloinse56 am 20.05.2025 05:13:57
Forum: SQL / Datenbanken
How Clean SQL Architecture Saves You From Technical Debt

Poor SQL structure leads to long-term pain. Without proper keys, normalization, or naming, everything downstream becomes harder to maintain and sc ...

Geschrieben von jenniekimberly am 20.05.2025 04:39:36
Forum: SQL / Datenbanken
Problem: Benutzer wird nach erfolgreichem Steam-Login nicht als eingeloggt erkannt

Hier mal die Debug Ausgaben die gesetzt werden nach dem Versuchten Steam Login Datei: cookie_check.log { "_lcp": "a", "fusionuc223_ ...

Geschrieben von Drakikosa am 19.05.2025 21:20:04
Forum: PHP Developer Forum