Jump to content

2nd preg_match_all doesnt have any data to search from (Curl used)


Nuv

Recommended Posts

While using Curl after the first preg_match_all, the second preg_match_all has nothing to search from. Which means $continue becomes empty. Why is it so ? My problem lies in this code or is there something else ?

 

<?php
$kh = curl_init ("http://www.xxx.com/xxx.php".$day[1][0]."");
curl_setopt ($kh, CURLOPT_COOKIEFILE, 'cookie.txt'); 
curl_setopt ($kh, CURLOPT_RETURNTRANSFER, true);
$continue = curl_exec ($kh);

curl_close($kh);
sleep(1);
preg_match_all('~<a\s+href="xxx.php?(.*?)"\s+accesskey="C"\s+class=\'nav\'\s+>~', $continue, $village);
$pattern = '/(?:\?|&)c=([^"&]++)/';
preg_match_all($pattern, $continue, $walk);
?> 

First off, preg_match_all() does not alter the subject in any way, so $continue is not "becoming empty" as you put it. 

 

2nd, we cannot even begin to help without knowing what the value of $continue is, and what you are expecting to get out of it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.