Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question php to javascript

    ok, here's what i want to do:

    I want to get the source code of a specific page from a website. this page is behind a password protected login page. I want to login into the site and then download the source code of the page i need. How could I go about doing this? Also, would it be better to use javascript or php for this? Originally I was using curl, but I am experiencing problems with it.

    Some notes on this: I believe the site uses cookies and javascript. Also, the site assigns you an ID# every time you access the page and then changes it when you login in. After you login in, the site keeps the ID# with your username while you are logged in but as soon as you log out it gives the ID to another person. I know the ID number is stored in cookies but don't know how to use it.

    thanks,
    ---rwb7041

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Location
    AZ, USA
    Posts
    685
    Thanks
    6
    Thanked 46 Times in 46 Posts
    So basically you need to hack into a site to get something you're not allowed to have?

  • #3
    New Coder
    Join Date
    Apr 2008
    Posts
    26
    Thanks
    6
    Thanked 0 Times in 0 Posts
    You want to pagescrape?
    Atlanta Web Design <- They do good work.

  • #4
    New to the CF scene
    Join Date
    May 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok i see where u got chgoto.js from

    i had the same problem. The way to make a drop down menu is alot simpler then that.


    say in one of your php files just add this code in the appropriate position:

    <form name="jump">
    <select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
    <option value="INSERT LINK">INSERT NAME</option>
    <option value="INSERT LINK">INSERT NAME</option>
    <option value="INSERT LINK">INSERT NAME</option>
    </select>
    </form>

    this will provide you with a drop-down menu. If you need to add more options, just add this line of code again:

    <option value="INSERT LINK">INSERT NAME</option>



    if you are having problems using it. make sure its outside of a <?php ?> command as its a html code - (WORKS FOR ME)

    goodluck

  • #5
    New to the CF scene
    Join Date
    May 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    binaryWeapon, that's not what i'm trying to do. the site i am talking about is a email site. I am trying to access my messages from that site without me physically logging into the site and checking the messages. That way, if I don't have internet, I could set up the script to automatically do it and archive my messages for me. Also, I can go to the site and view the source code no problem, so it is not hacking.

    pixencom: what do u mean by a pagescrape?

    Mirey: what are u talking about? I am not quite sure what the code u posted is supposed to do. I understand the dropdown box, but what is the onChange for. plz explain.

    thanks,
    rwb

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Javascript can't do what you're looking to do. Mirey86's post is completely ridiculous. CURL is your best option. It can store cookies so you can login to a site, and then browse around.

  • Users who have thanked Inigoesdr for this post:

    rwb7041 (05-20-2008)

  • #7
    New to the CF scene
    Join Date
    May 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ok, but here's my problem with cURL, I am having trouble with redirects and with saving cookies. Since PHP 4.4.x or something like that, cURL can't do redirects because of some stupid settings in PHP. Also, the cookie saving seems to be tripping me up a little, could anyone explain it.

    One last thing with cURL, can someone explain the process of posting to a website for me? I am having trouble on figuring out how to post with a set action and then post my login info.

    Thanks,
    rwb

  • #8
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    The manual does a much better job of explaining it than I could. See the examples, and comments. Specifically for curl_setopt().


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •