Jump to content

galayman

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

galayman's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm offended, blame me for being dumb at PHP and asking question.
  2. Whats wrong??? It's useless anyway to protect it, because, if we can read it, we can get the contents, i'm not trying to attack it, i just need the contents. I read a lot of web everyday, i want to make my own single page, and inside it will display all the info that i've saved before using this method.
  3. No thats not working, I've tried that before fread() need the filesize and i cannot get it. this is the warning : Warning: Wrong parameter count for fread() in /var/www/html/test.php on line 22
  4. Hi guys I have this code <? // the site we want to read $host = "www.some-site.com"; // the file we want to read $file = "some-file.htm"; // construct a header for our request $hdrs = array( 'http' => array( 'method' => "POST", 'header'=> "accept-language: en\r\n" . "Host: $host\r\n" . "Referer: http://$host\r\n" ) ); $context = stream_context_create($hdrs); $fp = fopen("http://" . $host . "/" . $file, 'r', false, $context); // $contents = Here I don't know how to read inside $fp ------- Missing code ------- $file = fopen("/home/user/my_file", "w+"); fwrite ($file, $contents); fclose($file); fclose($fp); ?> This code is to read file from somesite, the page is protected using referrer, everyday i open the site using browser, but i need to read it quickly, thats why i use that script. I need to write the content to my_file located at /home/user/ The question is, how to read $fp in string ? In the end it will writed to my_file Please help, I already using fgets, fread, file_get_contents. I'm new to php, that's why i cannot solve this problem. Thank You.
  5. waw! phpfreaks guru is the best! Thank you, i love php and i love everyone here too!
  6. Hi All, i have this array $ary = array( "Today date is 1, our breakfast is 2 eggs and salad", "Today date is 13, our breakfast is 3 breads and beff", "Today date is 18, our breakfast is 2 toasts with egg", "Today date is 21, our breakfast is 5 wafels with honey", "Today date is 30, our breakfast is a bowl of sereal" ); i need to search and match the date (that i have bolded it) and then compare it to today date using this fuction date("j"); to find the date in the string i'm using this regex ([1-3][0-9]?)(?=, our) i have try everything but i cannot solve it so in the end, if today date is 18 i want to display only this string Today date is 18, our breakfast is 2 toasts with egg can i do this? Thank You , Best Regards
  7. TOPIC SOLVED! here is the answer http://www.phpfreaks.com/forums/index.php/topic,169786.0.html
  8. once again thank you, you are a nice person pocobueno1388, i hope good things happen to good people like you.
  9. waw! there is a lot of php guru here, and they are a nice person too, help me only in a few minute, i hope i have e money and can donate to php freaks thank you. TOPIC SOLVED!
  10. Hi all, i have this array $str = array("apple is red", "banana is yellow", "pineaple is tropical fruit", "coconut is also tropical fruit", "grape is violet"); i want to find string "coconut" inside $str and put the whole string "coconut is also tropical fruit" into variable $coconut. can i do this? i don't want to use the this code <? $coconut = $str[3]; echo "$coconut"; ?> can someone help? Thank you, Best Regards
  11. no is not, your solution works! thank you very much TOPIC SOLVED!
  12. Hi, i hope by keep asking this question i'm not make someone mad, thank you for your reply, but when i try to put this code : (\d+?) the result is this : COMPOSITE 2671.895 AGRI 2539.764 MINING 3209.723 BASIC-IND 235.2 MISC-IND 442.814 CONSUMER 421.708 PROPERTY 227.708 INFRASTRUC 879.216 FINANCE 254.461 TRADE 385.862 MANUFACTUR 387.163 LQ 587.978 Can you please help... i only need the Thank You, Best Regard
  13. this is the full string : COMPOSITE 2671.895 AGRI 2539.764 MINING 3209.723 BASIC-IND 235.2 MISC-IND 442.814 CONSUMER 421.708 PROPERTY 227.708 INFRASTRUC 879.216 FINANCE 254.461 TRADE 385.862 MANUFACTUR 387.163 LQ 587.978 i need to find the second, fourth, sixth, eight, tenth and so on to replace it with br tag as you can see, i have bolded the can i find and replace it? what is the regex? This code : (( ){2})A/ will find COMPOSITE 2671.895 AGRI 2539.764 MINING 3209.723 BASIC-IND 235.2 MISC-IND 442.814 CONSUMER 421.708 PROPERTY 227.708 INFRASTRUC 879.216 FINANCE 254.461 TRADE 385.862 MANUFACTUR 387.163 LQ 587.978 and this code : (COMPOSITE)+(.*?)([ ])+(.*?)([ ])+(.*?) fill find COMPOSITE 2671.895 AGRI 2539.764 MINING 3209.723 BASIC-IND 235.2 MISC-IND 442.814 CONSUMER 421.708 PROPERTY 227.708 INFRASTRUC 879.216 FINANCE 254.461 TRADE 385.862 MANUFACTUR 387.163 LQ 587.978 but i need only the that located between the decimal and letter. Thank you, Best regards.
  14. Hi All, 6 hours i'm trying to find this solution, but no luck. please can someone help me. I have this string (it's only some part of it, but the other line is the same) COMPOSITE 2671.895 AGRI 2539.764 i need to find this string first i'm using this regex [0-9] [A-Z] and this is the result : COMPOSITE 2671.895 AGRI 2539.764 is there any AND operator in regex? so first using this [0-9] [A-Z] and with AND operator to find [ ] so the result is : COMPOSITE 2671.895 AGRI 2539.764 or maybe there is another solution to find it? in short how to find this substring? COMPOSITE 2671.895 AGRI 2539.764 but there is two in the code, i only need to find the second one Thank you Best Regards
  15. well, i think i to make it to array i can use explode, but right now i need the data in string format. is there a way to change the "coffe 34,123 1,220 1,150 1,200 +40" to "coffe price : 34,123 volume : 1,220 high : 1,150 low : 1,200 up :+40" using regex to add the "price" string? i only need to add a string between the letter and decimal, and i'm planning to use it in large number of line, maybe regex can help me. Best regards
×
×
  • 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.