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


Groups > comp.lang.php > #17977

Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception?

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.php
Subject Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception?
Date 2019-06-12 08:54 +0200
Message-ID <gmblsaFqtr4U1@mid.individual.net> (permalink)
References <1o3z8vwk6x9am$.54ia46ki18ga$.dlg@40tude.net>

Show all headers | View raw


JJ:

> I'm trying to make a simple proxy script for my web server in my local
> network, but I've found that `curl_exec()` abruptly terminates my script
> without any error or exception on some websites.
[...]

In addition to everything else already discussed here:

> FYI, my PHP application came from XAMPP (xampp-portable-win32-7.3.2-0-VC15).
> 
> Here's the simplified script to reproduce the problem.
> 
>   <?php
>   function doResponseHeaders($cu, $dt) {
>     header($dt);
>     return strlen($dt);
>   }
>   $cu = curl_init('https://www.youtube.com/');
>   curl_setopt($cu, CURLOPT_HEADERFUNCTION, 'doResponseHeaders');
>   try {
>     echo 'CURL = ' . curl_exec($cu);
>   } catch (Exception $e) {
>     echo 'CURL_EXCEPTION';
>   }
>   curl_close($cu);
>   echo 'ALL_DONE';
>   ?>
> 
> When run, the HTTP 200 is returned, but there is no HTTP body.

This works fine for me here (Linux with Apache 2.4, PHP 7.2 as FPM):

<https://arnowelzel.de/samples/youtube-proxy.php>

So to me this looks like a bug somewhere in the Windows port of PHP or
the Curl extension which can't be mitigated.

Instead of using XAMPP I would try to install Apache 2.4 and PHP 7.3
separately - it's not that hard to configure Apache and PHP manually.
But this way you can be sure that there is no additional problem with
the runtime environment.

Even better: use Linux and not Windows. The Windows ports are not tested
as well as the Linux versions and may behave in a different way.



-- 
Arno Welzel
https://arnowelzel.de

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


Thread

How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-05 10:45 +0700
  Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? "J.O. Aho" <user@example.net> - 2019-06-05 06:54 +0200
    Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-06 18:55 +0700
      Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-06 18:52 +0200
        Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-07 19:10 +0700
          Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-07 15:26 +0200
            Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-08 13:15 +0700
              Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-08 13:35 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Jerry Stuckle <jstucklex@attglobal.net> - 2019-06-08 11:58 -0400
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-09 08:46 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Jerry Stuckle <jstucklex@attglobal.net> - 2019-06-09 22:10 -0400
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Jerry Stuckle <jstucklex@attglobal.net> - 2019-06-09 22:13 -0400
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-10 20:42 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Jerry Stuckle <jstucklex@attglobal.net> - 2019-06-11 13:15 -0400
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-12 05:51 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Jerry Stuckle <jstucklex@attglobal.net> - 2019-06-12 10:37 -0400
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-12 22:11 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-11 18:24 +0200
              Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-08 13:20 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-09 09:08 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Jerry Stuckle <jstucklex@attglobal.net> - 2019-06-09 22:12 -0400
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-11 18:05 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-11 20:19 +0200
            Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-08 13:19 +0700
              Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-08 13:37 +0700
              Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-09 09:41 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-10 20:32 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-10 16:34 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-10 16:38 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-10 16:57 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-11 12:42 +0700
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-11 08:18 +0200
                Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-12 05:51 +0700
  Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-05 21:35 +0200
  Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Arno Welzel <usenet@arnowelzel.de> - 2019-06-12 08:54 +0200
    Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-12 18:07 +0700
      Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-12 21:51 +0700
        Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Arno Welzel <usenet@arnowelzel.de> - 2019-06-12 17:12 +0200
          Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? JJ <jj4public@vfemail.net> - 2019-06-13 00:12 +0700
      Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Arno Welzel <usenet@arnowelzel.de> - 2019-06-12 16:59 +0200
    Re: How to handle curl_exec() so that it won't terminat my script abruptly without any exception? Luuk <luuk@invalid.lan> - 2019-06-12 22:25 +0200

csiph-web