Jump to content

mraza

Members
  • Posts

    329
  • Joined

  • Last visited

    Never

Posts posted by mraza

  1. First of all thanks the182guy for suggestion, and thank you WebStyles too for contributing.

     

    Actually i forget to mention sir, its an image hosting type script, and i wants to host images on sub-dmains so i can split server load to various sub-domains on other servers. so now i am generating a link like this

     

    http://mysite.com/SomeRandmID/filename.image

     

    so user can use above link to share there images. Now if i use that method which you are both suggesting, how can i manage that. so actual image link user will get as below.

     

    http://sub-domain.mysite.com/SomeRandmID/filename.image

     

     

  2. Hi

     

    I have a form which is used to upload files to my server, now i need to move files to another server as soon they are uploaded, but move_uploaded_file will work with local server where form has been submitted.

     

    i was thinking to add some ftp functions to upload that file to remote server but is there any better way?  that user dont notice ftp connection timing. i wants to use less ftp connections and user should not notice delay timing for image upload.

     

    Thanks  for any suggestion.

  3. hi

     

    is it possible to run multi instance of a loop? here is my code example

    $data = array (
                     array("first" = >"First name"),
                     array("first" = "Second name")
                 );
    
    foreach($data as $process){
    echo $process["first"] . "\n";
    // some function($process["first"])
    }
    

    above will output

    Fist name
    Second name
    

     

    in above foreach it echo first element of $data array then echo next element,  can it process both at same time?  like for example if my $data array contains 20 multidimensional array and i wants to process 5 array at same time rather then it will process all one by one.

     

    is there any possibility?

     

    Thanks for any help.

     

     

  4. hi,

    I have a domain over 2k posts indexed.. I wants to change it from

     

    http://site.com/category/1021-this-is-title-here.html

    to

    http://site.com/category/this-is-title-here-1021.html

     

    so post id would go at the end with my  new structure. and still if someone visit that old url it will redirect to new url of that post.

     

    What should i do to achieve it , i believe something todo with .htaccess

     

    Thanks for any help

     

  5. Hi,

    I have some text coming like this

    this is text <a href=""> School </a> and 
    this is <a href=""> another text </a> and this what i need 
    to remove <a href="">http://somelink...</a> also
    

    I wants to remove all href tags but leave inner text if it is not an http link, i have this regex but this remove all of my text but as above example i wants to keep "School" and "another text".

    results should like like this after  regex.

    this is text School and
    this is another text and this what i need
    to remove also
    

    .

     

    regex i have

    preg_replace("/<a[^>]+href[^>]+>.*\<\/a\>/", "", $text);
    

    but this remove all href tags with inner text.

    thanks for any help

  6. Thanks but when i use above i get question marks

    ����������
    

     

    my code

    $file = "C:\file.txt";
    $data = file_get_contents($file);
    // tried with this too
    // $data = mb_convert_encoding($data, "UTF-8", "ISO-8859-1");
    header("Content-Type: text/html; charset=UTF-8");
    echo $data;
    

     

    also when i did detect i get UTF-8 Result

    $data = file_get_contents($file);
    echo mb_detect_encoding($data);
    // echoed UTF-8
    

  7. thanks for replies.

     

    I tried both way but did not worked.

    here is original file content

    http://www.pastecode.info/view/29305328

     

    and here is problem if i use above codes

    http://www.pastecode.info/view/75500574

     

    when i tried with htmlentities($data, ENT_QUOTES, "UTF-8"); i get cahrs like this and i had to use $data = mb_convert_encoding($data, "UTF-8", "ISO-8859-1"); or it just display blank page.

    ßßßÿÿÿ

     

    my code again:

    $file = "C:\file.txt";
    $data = file_get_contents($file);
    // tried three of them one by one and together etc but same problem.
    //$data = mb_convert_encoding($data, "UTF-8", "ISO-8859-1");
    //$data = htmlentities($data, ENT_QUOTES, "UTF-8");
    //header("Content-Type: text/plain; UTF-8");
    echo $data;
    

    thanks for any help.

  8. Hi, I have few files which i need to display in correct format and also save in db to use. My problem is here is my code:

    $file =  "C:\\file.txt";
    $data = file_get_contents($file);
    $data = '<pre>';
    $data .= mb_convert_encoding($file, 'UTF-8', 'ISO-8859-1');
    $data .= '</pre>';
    echo $data;
    

     

    but when i echo $data i get weird characters . here is result

    http://paste2.org/p/1361878

     

    Thanks for any help.

     

  9. HI, I am having a wierd problem using abvoe method. here is my code

    $items = array();
    foreach ($xmlload->channel->item as $item) { 
    $ns_content = $item->children('http://purl.org/rss/1.0/modules/content/');
    $desc = $ns_content->encoded;
    $description = $item->description;
    // echo $description; // this looks nomal here on echo
    $categories = array();
                    foreach ($item->children() as $child) {
                        if ($child->getName() == 'category') {
                            $categories[] = (string) $child;
                        }
                    }
    
        $items[] = array(
    				"title" => $item->title,
    				"link" => $item->link,
    				"desc" => $desc,
    				"description" => $description,
    				"categories" => $categories
    			);
    }
    
    $items = array_reverse($items);	
    print_r($items);
    

    when i do print_r i get this result

    [0] => Array
            (
                [title] => SimpleXMLElement Object
                    (
                        [0] => Title of post
                    )
    
                [link] => SimpleXMLElement Object
                    (
                        [0] => http://www.linktofeed.html
                    )
                [desc] => SimpleXMLElement Object
                    (
                    )
    
                [description] => SimpleXMLElement Object
                    (
                    )
    
                [categories] => Array
                    (
                    )
    
            )
    

     

    in [description] i am getting SimpleXMLElement Object as description not original one. I tried to output echo as in above code

    // echo $description; // this looks nomal here on echo

     

    and there it display correct description but not when added in $items description. any help?

    Thanks

  10. Thank you sir, i actually had that array idea but is not there any other way that it can sort $xml items without adding this step to loop through all feed. Is it possible i will no need to assign new array for every elements i need like  -link -title etc and i dont need to change $xml->channel->item as $item  ?

     

    Thanks and Regards

     

    Edit: i m using this to get feed $xml = simplexml_load_file($feedurl);

  11. Hi, I am reading a feed with this code

     

    foreach ($xml->channel->item as $item) { 
    echo $item->title;
    echo '<br>';
    }
    

    and outputs

    title 1
    title 2
    title 3
    .... and so on until 10

     

    I wants in reverse order to output last rss feed first like:

    title 10
    title 9
    title 8
    .... and so on until 1

    , how can i do it? i tried with rsort($xml->channel->item) butt getting this error:

    Warning: rsort() expects parameter 1 to be array, object given in

    Thanks for help

  12. Thanks a lot for the code, i have actually a little problem still in that. if i use that code or mine above it will add dots to numbers i wants but i do not wants it to add dot at the last number,

     

    like its converting this 2011 03 02 to 2011.03.02.  <<< it is adding one dot at the end, is it possible to convert that to 2011.03.02 so no dot at the end.

     

    Thanks again

  13. Hi,

     

    I have a text where i need to replace space between digits with dots.

    example:

    And today date 2011 03 28 and also some other text
    and this could be second line of7 2 6 0 and continue like this...
    some other number like 8 0 6 9 and some other as well.
    but it will not add dot to this single digit 01 or even to this word 2000 as those are single 
    // there could be more this type of digits 
    

     

    Now i need to replace that date to 2011.03.28 and of7.2.6.0  and 8.0.6.9, i have various this type of digits i need to replace only space with dots between digits using regex, any help please to show me a regex pattern plz.

    Thanks

  14. Thank you sir , i checked manual and i see this

    
    SYNOPSIS
           crontab [-u user] file
    

     

    so for example if i execute in my php script

    exec("crontab -u username -e cronjobfile.php");
    

     

    will it use that cronjobfile.php to get cron jobs details? so i can add cronjobs to cronjobfile.php with my mysql db something, if you could show me a little bit of example i would really appreciate it sir.

     

    Thanks again

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