Jump to content

PHP script to grab webpage contents


manjunathtumkur

Recommended Posts

Hi all,

 

Am new to PHP programming and i need some help

 

i am writing a script to grab contents of a web page specified.

 

It is working perfectly for normal websites but for sites needing authentication its failing.

 

Like for example i want to get all the info from "www.google.com/history" ;even though i am logged in its saying please login again n again.

 

do i need 2 include cookies in the script.

 

Please help me n also please provide sample scripts if possible

Link to comment
Share on other sites

I'm sure someone can be more help than myself, but what I see happening is that you are logged in through your browser, but php runs on your host/server which is not logged in.  Maybe you can pass the username/password as variables to the page/login area, not sure.  I'm guessing you may need to use some type of session which is beyond my knowledge.

Link to comment
Share on other sites

Please can anyone provide code snippet which i can use

I already provided an answer to help you solve this yourself. There are plenty of tutorials out there on how to implement cURL to do what you need. I see no reason to provide a piece of code that may not meet your specific needs requiring many back and forth posts to get it exactly right. If you read (and follow) a tutorial on the subject you will understand exactly what the process does and how to implement it for your specific needs.

 

http://coderscult.com/php/php-curl/2008/05/20/php-curl-tutorial-and-example/

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.