People help with the expression is the title:

content-language:zh-CN content-length:0 date:Mon, 07 Mar 2016 15:46:25 GMT location:http://s.taobao.com/search?app=imgsearch&tfsid=TB1W6OpLVXXXXbsaXXXXXXXXXXX s:STATUS_NOT_EXISTED server:nginx status:302 Found strict-transport-security:max-age=31536000 timing-allow-origin:* version:HTTP/1.1 

how to cut this piece from this:

 TB1W6OpLVXXXXbsaXXXXXXXXXXX 

    1 answer 1

    If the text is in $txt , then try this:

     preg_match('/tfsid=(\w+)/s', $txt, $m); var_dump($m[1]); 
    • the result: null - mega94
    • curl responded like this: string(448) "HTTP/1.1 302 Found Server: Tengine Date: Mon, 07 Mar 2016 16:34:39 GMT Content-Type: application/octet-stream Content-Length: 0 Connection: keep-alive S: STATUS_NOT_EXISTED Location: http://s.taobao.com/search?app=imgsearch&tfsid=TB1CSKtLVXXXXcGXVXXXXXXXXXX Content-Language: zh-CN Set-Cookie: thw=xx; Path=/; Domain=.taobao.com; Expires=Tue, 07-Mar-17 16:34:39 GMT; Strict-Transport-Security: max-age=31536000 Timing-Allow-Origin: * " - mega94
    • No, the function is working ... Here, I checked: sandbox.onlinephpfunctions.com/code/… - cyadvert
    • I also checked everything ok, but what’s the problem with smoking е что ли? print_r ($ page); `so the header already shows preg_match('/tfsid=(\w+)/g', $page, $m);print_r($m[1]); do not display - mega94
    • try not to put /g , but /s - cyadvert