Jump to content

drew7721

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

About drew7721

  • Birthday 01/21/1985

Contact Methods

  • Website URL
    http://www.ghiban.com

Profile Information

  • Gender
    Male
  • Location
    Mtl

drew7721's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. GOT IT ! <?php $refurl = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); parse_str($refurl, $info); echo $info['q']; ?>
  2. Ok, first let me tell you what I want to do. Google sends me traffic from many keywords, but I want to track what keyword does best for me as sales and so. The Analytics is good but I can't send the data to outside sites. So I figured this out : from the $_SERVER['HTTP_REFERER'] I can get the "q" value from the _GET and pass it on to track it... now I'm kind of stuck and I know it's easy but can't seem to find the function. This is what I have so far: /* Code to try and store the keyword that was used to find and land on my site. */ $exurl = 'http://www.google.ca/url?sa=t&source=web&cd=1&ved=0CBYQFjAA&rct=j&q=mykeyword&ei=pJ2STMy8MsP-8AaqvuznBQ'; //set a demo refferer url that would usually be $exurl = $_SERVER['HTTP_REFERER'] $refurl = parse_url($exurl, PHP_URL_QUERY); // remove all before and including the "?" echo $refurl; // echo "sa=t&source=web&cd=1&ved=0CBYQFjAA&rct=j&q=mykeyword&ei=pJ2STMy8MsP-8AaqvuznBQ" Ok, so I managed to get the important part out of the google URL, now how do I split this into an array that I can then use. For instance somefunction($refurl, $newarray); and then I could say | echo $newarray['q']; | and it would echo "mykeyword" Of course If there is a space in the keywords I should use the urldecode() function to avoid the % char... Let me know if you know of any way to get this done.
  3. hey ignace! tried your version and it works great! Is there a place where I can read more on the funcions you used there and if there are more xml functions I can use... hard to find some good techniques and examples.. thx.
  4. nice! thx for the replys I'll test them out and get back to you asap! I hope this works!
  5. Hey! I'm trying to get a php code to read, mod and display information from an xml or RSS file.. and it's really more that a mess. Everyone told me it's easy but there must be something i'm doing wrong. First, the projet is to get Tv Shows news to display on a site. I got the api and RSS feeds form TVrage.com site and they update the xml contend daily, so all I need to do is to get the file and save it on my server for faster reading. (that I know how). Here is a sample of an rss file with the new shows that will play today : <?xml version="1.0"?> <channel> <title>TVrage</title> <link>http://www.tvrage.com/</link> <description>TVrage</description> <language>en-us</language> <pubDate>Thu, Jun 3 2010 11:23:56 PDT</pubDate> <ttl>60</ttl> <docs>http://blogs.law.harvard.edu/tech/rss</docs> <item> <title>08:00 pm</title> <link>http://www.tvrage.com</link> </item> <item> <title>- Good Eats (14x02)</title> <link>http://www.tvrage.com/Good_Eats</link> <description>Grillus Domesticus</description> </item> <item> <title>- So You Think You Can Dance (07x03)</title> <link>http://www.tvrage.com/So_You_Think_You_Can_Dance</link> <description>Auditions #5 and #6 / Vegas Callbacks, Part 1</description> </item> <item> <title>- My First Place (13x05)</title> <link>http://www.tvrage.com/shows/id-6829</link> <description>Buying a Home Sight Unseen</description> </item> <item> <title>- WWE Superstars (02x08)</title> <link>http://www.tvrage.com/shows/id-22359</link> <description>060310</description> </item> </channel> now I saved this file as today.xml on my server and it updates every 24 hours trough a php code fread() etc.. What I want to do is to only display the titles of the shows that will play today, no time, no description or link. Is there a way to do that? I'm sure there is, but i'm really new to this whole xml thing and I don't get it. I mean I have no problems to work with a MySql db but this, xml, my brain just does not process it! This is the piece of code I got so far from W3 schools : <?php $xml = simplexml_load_file("today.xml"); echo $xml->getName() . "<br />"; foreach($xml->children() as $child) { echo $child->getName() . ": " . $child . "<br />"; } ?> As you can see if you test it, it does not do quite what I want it to do. P.S. I'm not sure if I am in the right section of forum, sorry.. did not find any related articles to xml issues. Thank's in advance 4 your help.
  6. thank you! it works! YEAH ! radom words! <?php $limit=10; // set how many vatriations are wanted function randomtext() //setting funtion { $words = func_get_args(); //getting words from function $word = array_rand($words,1); // pick one random word return $words[$word]; // return picked word } if(empty($i)) { //decleare value of $i $i=1; } while($i<$limit) // do loop { echo randomtext("favorite","best","awsome","excellent").' - '.randomtext("test1","test3","test4").'<br />'; //echo words $i++; } //inrease value ?>
  7. Hello, I have this issue with the following code. I'm trying to generate random words from an array of given words. The problem is that I do not want to limit/force the ammount of words it needs to be able to randomize. baisically I want to be able to put : randomtext("word1","word2","word3","word4") randomtext("word5","word6") randomtext("word7","word8","word9") so that the function takes in consiteration the words no matter the ammount 2 or 20 and randomizes the output. Is there anyway to include all variables from function in the array ? here is the code : <?php $limit=10; // set how many vatriations are wanted function randomtext($value1,$value2,$value3,$value4) //setting funtion { $words = array($value1,$value2,$value3,$value4); //getting words from function $word = array_rand($words,1); // pick one random word return $words[$word]; // return picked word } if(empty($i)) { //decleare value of $i $i=1; } while($i<$limit) // do loop { echo randomtext("favorite","best","awsome","excellent").' - '.randomtext("test1","test2","test3","test4").'<br />'; //echo words $i++; } //inrease value ?> Thank you
  8. Hi! I'm looking to make a dropdown menu based on a db table SQL table: Categories cat_id = INT auto_increase PRIMARY cat_name = VARCHAR (80) parent_id = INT NOT NULL default 0 ------------- Now I want to populate this table with categories and sub categories. Main categories get 0 as parent_id Now I want to add a sub cat so I'll give it a parent_id = 1 for it's parent cat to be the cat with cat_id =1 But I want to make a dropdown menu on site that will show PARENT CAT 1 ---subcat 1.1 ---subcat 1.2 PARENT CAT 2 ---subcat 2.1 ---subcat 2.2 PARENT CAT 3 PARENT CAT 4 ---subcat 4.1 ETC! how do I do this? I've been killing myself over this? can someone help please???
×
×
  • 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.