PHP Stream Web Page Content

jdmrace

New Member
Messages
20
Reaction score
0
Points
0
I need assistance fetching or grabbing content from an external web page. I am trying to extract specific content from a member’s only page, which is not visible to the public. I’ll work on the preg_match pattern later. I don’t know how to set the username and password variables. If I would like to search different pages and fetch or submit content, would that require using a robot?
 

phpasks

New Member
Messages
145
Reaction score
0
Points
0
Actually What does done?
I don't understand.

If your problem only After login & before login than you can use session variable.

When login member at that time you will set session & solved your problem.

ob_start();
session_start();
$_SESSION["username"] = 'xyz';

if(isset($_SESSION["username"]))
{
echo "After Login Display here.";
}
else
{
echo "Before Login Display here.";
}
 

worldwise001

Member
Messages
57
Reaction score
1
Points
8
Are you using PHP to work this, and if so, from x10hosting's servers?

I don't know if x10hosting servers allow external web lookups, but using PHP (assuming you do) you should be able to get the external content. As for setting variables, I'd recommend looking at the source of that page and see how they transfer the login credentials, then make your script request the content after authentication.

I'm not entirely sure what you mean by "robot".
 

jdmrace

New Member
Messages
20
Reaction score
0
Points
0
Oh I mean web robot such as the googlebot. Is there any way to program a web robot through php?

Well anyway I am trying to login to myspace using php but I'm getting a bad request. Can anyone tell me what I'm doing wrong?
Code:
<?PHP
$data = array(
  "dlb"=>"Log+In",
  "ctl00%24ctl00%24Main%24cpMain%24LoginBox%24Email_Textbox"=>"EMAIL@DOMAIN.com",
  "ctl00%24ctl00%24Main%24cpMain%24LoginBox%24Password_Textbox"=>"PASSWORD"
);
$data = http_build_query($data);

$opts = array(
  "http"=>array(
    "method"=>"POST",
    "header"=>"Accept-Language: en-us\r\n".
              "Content-Length: ".strlen($data)."\r\n".
              "Host: secure.myspace.com\r\n".
              "Proxy-Connection: Keep-Alive\r\n".
              "Referer: http://www.myspace.com/\r\n",
    "content"=>$data,
  )
);

$context = stream_context_create($opts);
$loginpage = file_get_contents("http://secure.myspace.com/index.cfm?fuseaction=login.process",false,$context);

echo $loginpage;
?>

Does anyone know how to use php - Client URL Library (curl)
 
Top