Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.