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
https://forums.phpfreaks.com/topic/216170-php-script-to-grab-webpage-contents/
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.

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/

Archived

This topic is now archived and is closed to further replies.

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