Jump to content

champrock

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

champrock's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. HI I have a list of files to be downloaded. I had earlier planned to use curlmulti and download 5files at a time using that. But they vary greatly in their sizes so curlmulti will not be of much use because if one file is big and the rest of the 4files are finished then the script will simply wait for the bigger file to complete. I came across this code on php.net http://in.php.net/manual/en/function.curl-multi-exec.php page which supposedly does this: <?php $mcurl = curl_multi_init(); for(; { curl_multi_select($mcurl); while(($mcRes = curl_multi_exec($mcurl, $mcActive)) == CURLM_CALL_MULTI_PERFORM); if($mcRes != CURLM_OK) break; while($done = curl_multi_info_read($mcurl)) { // code that parses, adds or removes links to mcurl } // here you should check if all the links are finished and break, or add new links to the loop } curl_multi_close($mcurl); ?> I am unable to figure out how to get it to work. I dont know what the functions CURLM_CALL_MULTI_PERFORM , $mcActive etc mean. Can anyone please guide me on how to download 5files simultaneously and automatically start another instance of curl as soon as one of them is completed? thanks
  2. Hi I am trying to recursively search for a given file from a directory and all the subdirectories in it. I am unable to figure out how to achieve that and output all instances of the file with the complete paths. Can anyone please help me out in this? I searched php.net reference but somehow those code snippets mentioned do not return anything for me . Just a blank page. thanks a lot for all the help.
  3. Hi Please see this code that I have created. I want to achieve the same result in one go rather than through three or four commands. http://pastebin.com/d43482aec Can anyone help me out with this? thanks a lot
  4. I think i need to clarify my problem a bit. I dont want to download the entire page on the server also . Its not about outputting only the headers. I want the server to just check the headers. For example: if the file size is 10mb, then according the cURL command provided above, cURL will download the full file on the server and then output only the headers. My problem is that I dont want the server to download 10mb ! I just need the headers
  5. does this only get the headers? I dont want to download the full file cos that means loads of BW usage. curl_exec will get the full page right ? or am i missing something in this?
  6. (i will be trying to use the multithreaded option in curl to process several requests at once to save time.)
  7. HI I have a list of websites and i want to check if they are working or not. Is there any way to configure cURL to just get the header code that it gets? I dont want to download the full page as that will consume a lot of bandwidth. I believe "http_code" does that trick but that is after it fetches the full page. I dont want to fetch the full page. any suggestion or comments on how this can be done? thanks a lot
  8. thanks a lot. One more thing, can u please tell the regexp for matching all links ? I want to extract all links (http://) from raw data ? thanks
  9. hi i have some raw data from which i ned to extract some useful pieces.. data is in this form <Date>2008-05-07 22:57:18</Date> <Timestamp>23123123213</Timestamp> <Link>[b] I WANT TO EXTRACT THIS 1[/b] </Link> <Category id="12">Other</Category> <User>EXAMPLE</User> <Date>2008-05-07 22:57:18</Date> <Timestamp>23123123213</Timestamp> <Link>[b] I WANT TO EXTRACT THIS 2[/b] </Link> <Category id="12">Other</Category> <User>EXAMPLE</User> <Date>2008-05-07 22:57:18</Date> <Timestamp>23123123213</Timestamp> <Link>[b] I WANT TO EXTRACT THIS 3[/b] </Link> <Category id="12">Other</Category> <User>EXAMPLE</User> i want to extract all instances of "I WANT TO EXTRACT THIS" PLease suggest what regex do i use? I am trying to do this with preg_match_all? Is this right?
  10. thanks it works... used some minor editing and it works absolutely fine
  11. thanks a lot for ur prompt reply. <?php if (in_array($pageURL,array("abc.com","xyz.com","pqr.com","aer.com")) { echo 'Something'; } ?> i am using this code, but this still does not work. i dont know why but it is still showing "something" for domains which are not in that array. any way to make it case-insensitive?
  12. [code=php:0]<?php if ($pageURL === "abc.com" || "xyz.com" || "pqr.com" || "aer.com") { echo 'something'; } ?> [/code] helo. i am looking to create some snippet which basically does the following work 1. the $pageURL string contains this $_SERVER["SERVER_NAME"] (the domain of the page) 2. i want to match it up with few matches and output something in particular if the $pageURL is same as the above four matches. and not echo anything when $pageURL is different from the above 4. but when i am using this code, it is echoing "something" in every domain, even in lets say "blahblah.com" and "tommy.com". the logical comparison is not working any suggestions where i am going wrong?
  13. preg_match("/^[\ a-z0-9._-]+@[a-z0-9.-]+\.[a-z]{2,6}$/i", $info, $matches); does not work :(
  14. thanks a lot. that is the problem that i dont have email always on the third line. therefore i want something "preg_match" which can probably search the text file for occurances of "@" character and then echoing the string before and after that (to get the complete email)
×
×
  • 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.