Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.php > #4163

Re: curl Shell-Parameter vs. CURLOPT-Konstanten

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups de.comp.lang.php
Subject Re: curl Shell-Parameter vs. CURLOPT-Konstanten
Date 2017-07-13 16:00 +0200
Organization PointedEars Software (PES)
Message-ID <2392003.mvXUDI8C0e@PointedEars.de> (permalink)
References <ojihhm$pu2$1@dont-email.me> <1981390.3ZeAukHxDK@PointedEars.de> <ojrgak$ugn$1@dont-email.me> <2386485.mvXUDI8C0e@PointedEars.de> <ok2fkb$jao$1@dont-email.me>

Show all headers | View raw


Ralph Stahl wrote:

> Thomas 'PointedEars' Lahn schrieb:
>> Ralph Stahl wrote:
>>> Thomas 'PointedEars' Lahn schrieb:
>>>> Ralph Stahl wrote:
>>>>> Gibt es irgendwo eine Gegenüberstellung zu lesen, welche
>>>>> Shell-Parameter
>>                                                              
^^^^^^^^^^^^^^^
>>>>> von curl welchen PHP-Optionen (Konstanten CURLOPT_...) in PHP
>>         ^^^^         ^^^                      ^^^^^^^^
>>>>> entsprechen?
>>>>
>>>> […]
>>> Danke dass du für mich Frau Google befragt hast ;-). Wenn man weiß,
>>> wonach man fragen muss, ist es wirklich leicht - ich wusste es eben
>>> nicht...
>> 
>> Du musst jetzt ganz tapfer sein:
>> 
>> <https://www.google.ch/search?q=Shell-Parameter+curl+PHP+CURLOPT_>
>> 
>> im Inkognito-Fenster (also unabhängig von meinem Google-Konto) liefert
>> obigen URI als ersten Treffer.
>> 
>> Bei
>> 
>> <https://www.google.com/search?q=Shell-Parameter+curl+PHP+CURLOPT_>
>> 
>> ist es der dritte und bei
>> 
>> <https://www.google.de/search?q=Shell-Parameter+curl+PHP+CURLOPT_>
>> 
>> der vierte.
>> 
> 
> Sehr schön. Nur, den von gesuchten Parameter-Ersatz für -L (das hatte
> ich allerdings nicht erwähnt, sorry),

Du hattest es erwähnt.

> nämlich CURLOPT_FOLLOWLOCATION, hat keine dieser Quellen zutage gefördert,
> […]

| $ curl -L foo --libcurl -
| […]
| curl: (6) Could not resolve host: foo
| /********* Sample code generated by the curl command line tool **********
|  * All curl_easy_setopt() options are documented at:
|  * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html
|  ************************************************************************/
| #include <curl/curl.h>
| 
| int main(int argc, char *argv[])
| {
|   CURLcode ret;
|   CURL *hnd;
| 
|   hnd = curl_easy_init();
|   curl_easy_setopt(hnd, CURLOPT_URL, "foo");
|   curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
|   curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, 1L);
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|   […]
| }
| /**** End of sample code ****/
| 
| $ curl --version
| curl 7.50.1 (x86_64-pc-linux-gnu) libcurl/7.50.1 GnuTLS/3.5.3 zlib/1.2.8 
| libidn/1.33 libssh2/1.7.0 nghttp2/1.14.0 librtmp/2.3
| Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 
| pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
| Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM 
| NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets

> auch nicht der genannte Konverter - ist also alles nicht vollständig.

Das steht ja auch da.  Man sollte[tm] wohl besser einen Konverter schreiben, 
der “curl --libcurl -” verwendet und das Ergebnis von C nach PHP 
konvertiert.  Im Prinzip braucht man dafür nur ein paar reguläre Ausdrücke.

> Die Frage an Google nach "php curl redirect" allerdings schon.

Kommt darauf an.
 
> Nichts für ungut,
> 
> $c = curl_init();
> curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
> 
> ist die gesuchte Lösung als Ersatz für -L.

Richtig.

-- 
PointedEars
Zend Certified PHP Engineer <http://www.zend.com/en/yellow-pages/ZEND024953>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to de.comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

curl Shell-Parameter vs. CURLOPT-Konstanten Ralph Stahl <post@rstahl.de> - 2017-07-05 13:15 +0200
  Re: curl Shell-Parameter vs. CURLOPT-Konstanten Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-06 12:20 +0200
    Re: curl Shell-Parameter vs. CURLOPT-Konstanten Ralph Stahl <post@rstahl.de> - 2017-07-08 22:50 +0200
      Re: curl Shell-Parameter vs. CURLOPT-Konstanten Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-09 05:26 +0200
        Re: curl Shell-Parameter vs. CURLOPT-Konstanten Ralph Stahl <post@rstahl.de> - 2017-07-11 14:21 +0200
          Re: curl Shell-Parameter vs. CURLOPT-Konstanten Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-13 16:00 +0200
            Re: curl Shell-Parameter vs. CURLOPT-Konstanten Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-13 16:37 +0200
              Re: curl Shell-Parameter vs. CURLOPT-Konstanten "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-07-13 18:17 +0200
                Re: curl Shell-Parameter vs. CURLOPT-Konstanten Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-07-17 20:33 +0200

csiph-web