[Labs-l] Strange PHP cURL issue

Zhaofeng Li zhaofeng at zhaofeng.li
Sat May 2 02:11:40 UTC 2015


Hi folks,

I use the cURL extension in PHP to fetch remote web pages on Tool Labs. 
It works perfectly on Tool Labs when the script is run manually with 
the php command (on tools-login). However, when the PHP script is 
accessed from a browser (the script runs on an exec node), cURL 
mysteriously fails for some pages, returning an empty string for the 
curl_exec() call. Anyone can figure out what's wrong? An example of 
such pages is http://www.geoffreylandis.com/vacuum.html

I've built a simple test script on
https://github.com/zhaofengli/stuff/blob/master/labs-connrst.php ,
and you can test it by:
1. running the script on your own box or on Tool Labs, with the php 
command (It should work with 200 in http_code and a non-zero 
size_download value)
2. copying the script to your public_html and accessing it from your 
browser (It should fail with 0 in http_code and a zero size_download 
value)

Background: https://github.com/zhaofengli/refill/issues/11

Zhaofeng Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.wikimedia.org/pipermail/labs-l/attachments/20150502/1a065774/attachment.html>


More information about the Labs-l mailing list