Jump to content

l33tmeerkatslol

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

l33tmeerkatslol's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. For my site I need to screenscrape a page on a site. The problem is, to access the page that contains the data I need, I have to login to my account first. I know there are ways to simulate a form submission with ASP, but my server is Linux and can't use ASP. I'm wondering if any of you know how I would be able to simulate a POST with something like cURL? And possibly write an example script? Thanks in advance. (This may be in the wrong section, please move it if it is. Thanks)
  2. Is it because you have the functions written in your file, but you don't execute them? Like all your variables and things are set in the file that you include_once, but you don't actually call upon the function, so the variables are blank.
  3. I did manage to get it working. I moved the $suffix= statement into the external file and it all seems to be working. Thanks guys!
  4. Could it be that the variable inside the function is local, therefore not receiving the value from the global variable declared in the index? :-\
  5. I'll try to explain this as easily as possible. I'm working on making a little link shortener site just for fun/practice as a beginner with php. I originally used the source code 'lilurl' as a base to start out, but now I'm adding stuff to it for actual practice. I need some help though. I have two files, my index and my external php file. The external file is called on at the beginning of the index with require_once. The user submits a url into the PHP_SELF form and a url is returned, and it works all great. Now I'm trying to add the option to make a custom url suffix. <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <fieldset> <label for="longurl">Enter a URL:</label> <input type="text" name="longurl" id="longurl" /> <input type="text" name="suffix" id="suffix" /> <input type="submit" name="submit" id="submit" value="Shrink!" /> </fieldset> </form> [/code] The form looks like this. I added the 'suffix' textbox. So after the user submits the code, it goes back up to the top (phpself). A variable is set for the url the user has inputted as "$longurl", like this. $longurl = trim(mysql_escape_string($_POST['longurl'])); So I added this. $suffix = ($_POST['suffix']); And to check if it worked, I went down the the bottom of the index and had it echo the suffix variable. When I entered in code into the suffix text box, it would be echoed at the bottom of the page, so the variable did receive the value. So here's where the external file comes in. It is called on by require_once at the very beginning of the index. It is full of functions. One of the functions generates a random string of numbers (that I coded) to be used as the url suffix (uses the $id variable). So my plan was to erase the $id = $rand1 . blah blah stuff and put $id = $suffix. $suffix being the variable from the index that the user inputted. Make sense? Well whenever I try it, it always acts the like the variable is empty, even when I echo it on the index it returns the value of the textbox. Does anyone know what I'm doing wrong? Could it be because since I call on $suffix in the external file, and it's only been declared in the index that it's treating it like a new/empty variable?
×
×
  • 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.