Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
登录网站,用PHP获取重定向的url内容_Php_Curl - Fatal编程技术网

登录网站,用PHP获取重定向的url内容

登录网站,用PHP获取重定向的url内容,php,curl,Php,Curl,我试图从一个我是会员的网站上获取内容(文本),我发现了很多关于如何使用cURL登录并获取上下文的示例,但是我不确定在登录到该网站后如何处理重定向。我从下面的代码中得到的结果是登录表单()。我想知道如果我没有访问权限,这真的有可能吗 $postdata = http_build_query( array( 'Account' => 'myaccount', 'Password' => 'mypass' ) ); $opts = array('http

我试图从一个我是会员的网站上获取内容(文本),我发现了很多关于如何使用cURL登录并获取上下文的示例,但是我不确定在登录到该网站后如何处理重定向。我从下面的代码中得到的结果是登录表单()。我想知道如果我没有访问权限,这真的有可能吗

$postdata = http_build_query(
    array(
    'Account' => 'myaccount',
    'Password' => 'mypass'
    )
 );

$opts = array('http' =>
        array(
         'method'  => 'POST',
         'header'  => 'Content-type: application/x-www-form-urlencoded',
         'content' => $postdata
    )
  );

$context  = stream_context_create($opts);

$result = file_get_contents('http://www.website.php/login.php', false, 
$context);
登录成功后,我希望从重定向的url中获取文本,该url看起来可能与