Jump to content

mcloan

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by mcloan

  1. I am trying to specify pramaters on a redirect. I figure I can <?php $strKeyword = $_GET['kw'];?> and then add ?sid=<?php echo $strKeyword ;?> to the below redirection. However I can not get the below to work. Does anyone know how I can accomplish this? When I run the below I just get a blank screen. It does not redirect. <?php header( 'Location: http://www.mylink.com/g9117y1A719PRVRXRZRPUQRRSWW?sid=<?php echo $strKeyword ;?>' ) ; ?> Thank you! thank you.
  2. I was totally was missing the ad, thank you. I implemented your suggestion like the below, but then page does not redirect at all with the below code. Any further suggestions would be much appreciated. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml"> <?php $strKeyword = $_GET['ad']; <head> <meta http-equiv="Refresh" content="0;URL=http://www.mylink.com/r/xxx/af=p40dd25&ad=echo $strKeyword ;?>"> <title>Repair Your Credit Today - Lexington Law</title> </head> <body> </body> </html>
  3. I have the below code but I can not get the last part of the redirect url ($strKeyword=<?php echo($_REQUEST['ad']); ?>) to pass on the redirection. It just comes up blank. When I echo it up top it reads the value to the screen but in the last part of the meta http-equiv="Refresh" it will not pass. Does anyone know how I can get around this and get it to pass with the url in the redirect? Thank you. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns=" http://www.w3.org/1999/xhtml"> $strKeyword=<?php echo($_REQUEST['ad']); ?> <?php echo($strKeyword);?> <head> <meta http-equiv="Refresh" content="0;URL=http://www.mysite.com/r/aff/af=p40XX5&ag=<?php echo($strKeyword);?>"> <title>Repair Your Credit Today - Lexington Law</title> </head> <body> </body> </html>
  4. Ok, I think I get it. Is the way I set my cookie ok? It appears weird cause in my cookie folder it is called index and is 528K. Does this sound right? Thank you.
  5. Perfect, that will work great. I have one more question. I am thinking some of my affilate links I want to redirect them though a php redirect. So I figure I can set a cookie and then in the redirect file it will read somthing like <?php header( 'Location: http://www.myaffilatelink.com?sid=<?=$_REQUEST['id']?>' ) ; ?> Cookie <?php if ($_REQUEST['sid']) { setcookie("requestid",$_REQUEST['sid'],time()+(86400*365),"/"); } ?> I have two question. The above cookie code is setting a cookie name index in my cookies and it is 528kb. So I do not think the code is working. Can someone suggest what I need to do to make this code work correctly? Secondly, if in the link h**p://www.myaffilatelink.com?sid=<?=$_REQUEST['id']?>' if I want to add the $reference="lp1" so that the final output will be h**p://www.myaffiliatelink.com?sid=lp1-keyword how do I do this? Your help is much appreciated. I have been trying so many different ways and can not get any of them to work. I am going nuts... LOL. Thank you.
  6. I am not sure the ref would pick up for tracking in my Commissio Junction account beasue it only picks up sid from the affiliate link. So what I had hoped to do in make sid something like this lp1 online dating for the first landing page or lp2 online dating for the second landing page. So essentially the new sid code would combine the lp1 with the keyword passed in the url. Excuse my lack of understanding but is that what the above code does? Thank you.
  7. I am trying to use dynamic insertion with adwords. I need some help with the code. My url would be something like http://www.mysite.com/landingpage.php?q={keyword} Then on my landing page I would have the below code on an affilaite link. <?php $keyword = $_GET[’q']; if(!strcmp($keyword, “”)) { echo ‘<a href=”http://www.myaffiliatelink.com?sid=Default”>Anchor</a>’; } else { echo ‘<a href=”http://www.myaffiliatelink.com?sid=’ . $keyword . ‘>Anchor</a>’; } ?> However for the sid code where it picks up a $keyword I would also like to include a reference for the landing page. For instance maybe the sid in CJ would read lp1 - $keyword. This would allow me to split test different landing pages. I do not know how to insert the lp1 in the above code echo ‘<a href=”www.myaffiliatelink.com?sid=’ . $keyword . ‘>Anchor</a>’; . Is it possible? If so can some help me with this? Thank you.
  8. I have a php redirect on a php page as stated below. Can someone tell me if I want a message stating "you are being redirected to this site...." printed on the page how I would go about this? <?php header( 'Location: http://www.theredirectedsite.com' ) ; ?> Thank you.
  9. I have a static html site and I am going to be moving some urls to new locations on the site.  I would like to use a 301 redirect through a .htaccess file, but want to be sure I do it 100% correct.  From what I have read on the web the below is what I think I need to do.  Can someone tell me if I am totally correct. 1.  open blank note pad and save it as .htaccess 2.  For each 301 redirect simply place the below in as may times as needed: Redirect 301 /111-strawberrybread.html http://www.mysite.com/specialbreads/strawberrybread.html 3.  Save .htaccess file and place it in my root directory. Is this correct?  Secondly any special requirements need on the server to handle this other than apache server with mode rewrite turned on? Thank you!
  10. I am trying to post to a form with CURL and the form has a file name specified as the following: <input name="locator1:textPostalCode" type="text" id="locator1_textPostalCode" style="width:75px;" size="20" /> Is it correct I would make my $data variable for the post like the following?  I am concerned about the ":" in the name of $data.  Will this work with CURL? $data="locator1:textPostalCode=77090"; [code] $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURL_ERROR, 1); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600); curl_setopt($ch, CURLOPT_TIMEOUT, 600); // grab URL, and return output $Contents = curl_exec($ch); [code/] [/code]
  11. When using php curl is there something special that needs to happen when posting to a page with a dropdown box or do I just post it such as $data="producttype=$dropdownboxvalue";? Thank you.
  12. Thank you, I did check the manual, but I am a bit new to programming and was a bit confused by the examples becasue they were mostly using arrays. Thank you again your simplified version worked perfect and now I think I have the concept... :)
  13. [quote author=AndyB link=topic=117126.msg477620#msg477620 date=1165084611] str_replace() [/quote] You mind providing an example?  I tried this function and could not get it to work. Thank you.
  14. Can anyone tell me the best way to remove the + from $city=Apple+Valley so that $city become $city=Apple Valley ? Thank you!
  15. Is there a way to use strpos or a similar function to find a location and go backwards to another location.  i.e.  11234 Blank St, Houston, TX USA So starting from $position=strpos($line, "USA") would there be away to find the second comma going back from USA with a strpos or similar function.  I want to prevent from counting character positions if possible. Thank you.
  16. I have finally used curl_setopt($ch, CURLOPT_POST, true); and curl_setopt($ch, CURLOPT_POSTFIELDS, $data); on post forms to retrun results, but what about a GET Form Method?  How do you deal with these with curl?  The same commands?  The particular instance I am dealing with is a store locator and it is not as easy as just calling the url with the variables becasue it runs some script behind the scene that does a bunch of calculations for calculating the lat. and lon. of the store so it can call a mappoint map.  After the form submission the url is a mess and pretty customized to the zip code searched with lat and lon. Here is an example of the form action: [code]<form Method="GET" Action="http://go.mappoint.net/ccc/Geocode.aspx?brand=h&amp;FC=ccc&amp;FC=ccc" Name="OutsideUS">[/code] Here is an mocked up example of a resulting URL after the form submission: http://go.mappoint.net/ccc/PrxResults.aspx?&LOC=33.8982869073812%3a-117.612688299845&CT=33.8982869073812%3a-117.612688299845%3a14.2501126753095%3a10.6875845064821&DSN=MapPoint.NA&GAD2=&GCITY=&GSTATE=&GZIP=92880&GAD3=+92880&GAD4=USA&IC=33.8982869073812%3a-117.612688299845%3a33%3a+92880&LL=en-US&AD4=USA&FC=isccc&brand=a How would I deal with this in curl?  Your help is much appreciated. Thank you!
  17. I tried the string being $data="ZipCode=90277"; and it is still not working.  I got the exact same results.  If I print_r ($_POST); is just shows Array ( ) and if I print_r ($Contents); it just shows the page of $url without the results retruned from the post.  So if I did it manually it just looks like I pulled up the page by typing in the url to a browser, but it did not return the post results when I typed in a zip code and hit submit. Any further guidance you can provide is much appreciated.  This one is really killing me.
  18. [quote author=btherl link=topic=116526.msg474828#msg474828 date=1164677434] Yes, it's a requirement for curl to be installed.  But I expect most sites would have it.  Since your script doesn't crash, curl must be installed :)  If it wasn't, it would fail when trying to call curl_init(). I'm not sure what you mean by "the script does return the url called via curl, it just does not post the results".  What do you see when you echo $contents ? And about POSTFIELDS as an array or as a string, it may work on the site that it works on, but we are looking at the site where it doesn't work :)  It's worth trying the string format instead.  Maybe the site where it doesn't work doesn't support the array syntax.  For the example you gave there, you would use: [code=php:0]$data = "zip=$value&distance=500";[/code] If you're dealing with strings rather than integers, then you should urlencode() each variable value in the postfields string. [/quote] Good point I will give a try with the string.  What I mean is if I echo $contents it opens the page that was specified as $url in the curl statement.  But if you post to that page it redirects to another page to show the results in which case this redirect is not happening becasue there are no results showing when I echo $contents.      Can I ask you why most sites have curl installed I thought curl was more of a php thing.  Is this not the case?  Sorry if I am basic I am fairly new to php. Thank you.
  19. [quote author=btherl link=topic=116526.msg474800#msg474800 date=1164675636] I'll ask the obvious questions first.. is Curl installed on the site where it doesn't work? Does the script fail altogether, or do you just get an empty result?  Also, according to the documentation, POSTFIELDS should be a string rather than an array.  Eg [code=php:0]$data = "ZipCode=90277";[/code] [/quote] I was not aware the site I am calling has to have curl installed.  Is it a requirement? If I echo $Contents the script does return the url called via curl it just does not post the results.  Regarding the array, on the site that is working I am using $data in an array as the following and it is retruning the results no problem data=array('zip' => $value, 'distance' =>'500'); You further help is much appreciated. Thank you.
  20. Hello, I am trying to use CURL to post and return results from a form with the below curl function.  I have this function working on one site, but can not get it to return results on another site.  Are there things a site can do to prevent you from returning results via curl?  Below the dotted line are the essential elements of the form that is not working.  Can some help with why this may not be working and what I can do to get it to work?  After this curl function runs if I use print_r ($_POST); I get an empty array. [code] $data=array('ZipCode' => ‘90277’); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_USERAGENT, 'deepcrawler bot spider/0.1'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // grab URL, and return output $Contents = curl_exec($ch); // close curl resource, and free up system resources curl_close($ch); unset($ch); -------------------------------------------This is the form that is not working------------------------------------ <form name="zip_search" method="post" action="dl_frameset.asp"> <td><input type="text" id="text1" name="ZipCode" value=""  size="5" maxlength="5"></td> <a href="#" onClick="validateZip();" onMouseOver="if (blnLoaded) {rollOn(objImgLocate1)}"  onMouseOut="if (blnLoaded) {rollOff(objImgLocate1)}"><img src="/images/dealer_locator/button_locate.gif" alt="Locate" name="imageLocate1" width="42" height="17" border="0" id="imageLocate1"></a> [/code] Thank you.
  21. mcloan

    Fwrite

    If I am using fwrite to write to a file, what is the best way to find the next blank row in the file so that it does not overwrite data already in the file? Your help is much appreciated.  Thank you.
  22. [quote author=btherl link=topic=116101.msg472875#msg472875 date=1164332463] The missing bit can be: [code=php:0]$multi_array[$dealername][] = array(   'address' => $address,   'phone' => $phone, );[/code] Then use var_dump($multi_array) to see what you've created :)  This code assumes there can be many addresses for each dealername. [/quote] Works perfect.  Thank you so much.
  23. This below script is a portion of a script that loops through a store locator a returns multiple address and phone numbers for multiple store locations. Can someone tell me the best way to add the values to an array and export them to csv?  I have tried every thing and can not get it to work.  I am assuming I need a multi dimensional array but can't seem to get it to work when I assign it in the loop. Please help.  I really appreciate it. [code] <?php foreach($Lines as $Line) { if (strstr($Line, 'addre')) // EXAMPLE ONLY! { $counter=$counter+1; $strTag="True"; $address=$Line; } if ($counter==6) { $phone=$Line; $strTag="False"; $counter=0; } if ($strTag!="False") { $counter=$counter+1; }             if(!empty($dealername)&&!empty($address)) {                         //I need to assign to an associtive array here } }       //I need to output the entire file to .csv here. ?> [/code]
  24. I am trying to return some retail store loacations off a site from a store locator.  Each url I visit has multiple stores listed and I want to return each one.  Each store is in the following format on the page and I want to return name and address to a seperate variable. name address So essenitally what I am doing is using $Contents = file_get_contents($URL);  to return the information and then looping line by line.  I have sucessfully returned the first line "name" no problem, but I am having trouble returning address.  As you will see in the below code the name field is easily identified by using strstr($Line, 'appro')), but the address line is not easily indentified.  What I was hoping to do with the address line is to use a counter that starts when the progam find a match for the name line.  Then when the counter counts each loop for the next four line (there is html on 4 lines after the name and the 5 line is the address line) I would know when the counter is 5 it will be on the address line and I can set this variable. Hopefully that makes sense.  In a nutshell it is not working at all.  I think it may be the way the for each loop is working.  Can anyone offer some input?  Your help is much appreciated. Here is the code I thought would work: My logic here is once I get the contents I set a counter.  The counter would become 1 when it finds the first name on the page then the for each loop loops for four more line and the counter become 5 in which case I know to retrun address on that line. [code] <?php $URL = "http://www.mysite.com/92880/"; $Contents = file_get_contents($URL); $Lines = preg_split("/\n/",$Contents); $counter=0; $strTag="False"; foreach($Lines as $Line) { if (strstr($Line, 'appro')) // Found Name Match and set $strTag="True";  (this is working fine) { $strTag="True"; $dealername=$Line; echo $dealername; } If ($strTag="True") // If found a name match for each loop after this line it increases counter by 1 { $counter=$counter+1; } if ($counter=5)  // If counter is 5 set address variable since this should be the address line.  (this part is not working) { $address=$Line; echo $address; $strTag="False"; $counter=0; } } ?> [/code]
  25. Can someone tell me what the $this->content of the code below means? $lines = preg_split('/\r?\n/', $this->content); Thank you.
×
×
  • 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.