User Profile

Collapse

Profile Sidebar

Collapse
a2rodger
a2rodger
Last Activity: Mar 6 '08, 02:43 AM
Joined: Dec 4 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Getting rid of the 'e' seemed to solve the problem.
    Although I'm not sure why.

    preg_replace("/\s/" , "_" , $url));
    See more | Go to post

    Leave a comment:


  • a2rodger
    started a topic regular expression to replace space by underscore
    in PHP

    regular expression to replace space by underscore

    I am using the following code to replace spaces with "_" for my URL rewriting
    function.

    $url = urlencode(preg_ replace("/\s/e" , "_" , $url));


    It get thrown the following error and can't figure out what it's trying to tell me,

    Notice: Use of undefined constant _ - assumed '_' in : regexp code on line 1

    Help!

    (Note: I'm using PHP...
    See more | Go to post

  • a2rodger
    replied to Printing out results from an array.
    in PHP
    That is close to what I am looking for.

    However, I need the date $val and the count $val to have seperate
    variables.

    I am inserting both of them into seperate rows of my mysql database.
    See more | Go to post

    Leave a comment:


  • a2rodger
    replied to Printing out results from an array.
    in PHP
    That looks right to me.

    Any clue how to loop through it and print each result?

    Thanks,
    See more | Go to post

    Leave a comment:


  • a2rodger
    replied to Printing out results from an array.
    in PHP
    $api = new duckSoup; // create a new object

    $api->api_key = "XXX"; // your API key

    $api->type = 'dailycounts'; // what API?

    $api->params = array('q' => ''.$name.'','da ys' => '7'); // the parameters

    $content = $api->get_content( ); // The 'content' Array


    print_r($conten t);
    See more | Go to post

    Leave a comment:


  • a2rodger
    started a topic Printing out results from an array.
    in PHP

    Printing out results from an array.

    I am relatively new to php and am struggling with printing out each result from the
    following array.

    Array ( [result] => Array ( [queryterm] => Britney Spears [days] => 7 [searchurl] => http://technorati.com/search/Britney+Spears ) [item] => Array ( [0] => Array ( [date] => 2008-02-24 [count] => 889 ) [1] => Array ( [date] => 2008-02-23 [count] => 2403 ) [2] => Array ( [date] => 2008-02-22...
    See more | Go to post

  • a2rodger
    replied to PHP RegExp Help!
    in PHP
    That did the trick. Thanks!
    See more | Go to post

    Leave a comment:


  • a2rodger
    started a topic PHP RegExp Help!
    in PHP

    PHP RegExp Help!

    I have the following regular expression which is stripping all unwanted characters before sending a variable to a url.

    $url = preg_replace('~[^\\pL0-9_]+~u', '_', $url);

    The problem is I would like to keep single quotation marks or encode them for the url so that I may retrieve them on the next page. The function above is currently getting rid of all single quotes.

    I hacked this together and am not sure...
    See more | Go to post

  • a2rodger
    started a topic How to get Subdomain with parse_url()
    in PHP

    How to get Subdomain with parse_url()

    I am using the following function and parse_url() to attempt to grab the subdomain from my sites url

    [code=php]
    function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolo wer($_SERVER["SERVER_PROTOCO L"]), "/").$s; $port = ($_SERVER["SERVER_POR T"] == "80") ? "" :...
    See more | Go to post
    Last edited by Atli; Dec 5 '07, 08:01 AM. Reason: Added [code] tags.
No activity results to display
Show More
Working...