Jump to content

champrock

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by champrock

  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)
  15. this is my text file. i just need to know how to extract example@example.com from that file. moreover, i have opened the file already and parsed it but i dont know how to extract the email.
  16. can anyone help me out? i just need to know the exact function to extract email addresses.
  17. text files are small (80-90lines) but the number of text files is large. (more than 1500 unique files) so i need some script to extract that data which i can add to a data properly. i dont want to add raw data to the database
  18. hi i have a small text file containing the details of my users (it was very old when i did not use databases) So i want to create something in php which will open that details.txt file and search for email addresses and lists them together with the name of the person. The name of the person can come easily from the text file as the files are names john.txt, tim.txt etc. I just need to extract emails now. Can anyone help me? ALso, it should list all email addresses (sometimes there are 2-3 email addresses) Thanks
  19. Hi I was planning to change the encoding mechanism of my proxy websites. I am right now using base64_encode for the purpose (which is the default). Please see the code that I need to make changes http://pastebin.com/m20da3c65 For this I need to edit proxifyURL() and deproxifyURL() functions which are given in the pastebin above. I am looking to add some sort of a key mechanism where i can specify a key and change it daily or on a periodic basis. Better would be a dynamic key which is generated automatically from the server "DATE". Any kind of help / guidance/ tutorial / codes will be highly appreciated. PS: I am not at all an expert in PHP. I just manage to do things with the help of php.net
×
×
  • 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.