gpt4 book ai didi

java - 加载curl php页面时如何获取java生成的元数据

转载 作者:行者123 更新时间:2023-11-29 08:58:06 25 4
gpt4 key购买 nike

我如何获取一些由 java 脚本生成的元数据是源代码我可以在这里看到这是我的 curl 函数

<head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script>
<title>Bitcoin Wallet - Coinbase</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/apple-touch-icon-iphone-114.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/apple-touch-icon-iphone-114.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/apple-touch-icon-ipad-144.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-ipad-144.png" />

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-Frame-Options" content="deny" />

<link href="/assets/application-872c8328f77eafb2d1ace7dbcf51cb1b.css" media="all" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[window.jQuery || document.write(unescape('%3Cscript src="/assets/jquery-056780eda252b4dc226532b22d80dc1a.js" type="text/javascript">%3C/script>'))//]]>
</script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="zqNomg7I3GGiY80OjMAAMG/Lbr76CFuob4iljqMlszU=" name="csrf-token" />

<script type="text/javascript" src="//use.typekit.net/pkh0ghc.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>

这是我需要的部分

<meta content="zqNomg7I3GGiY80OjMAAMG/Lbr76CFuob4iljqMlszU="

我如何使用 php curl 来实现这里是我当前的 curl 脚本我可以添加什么来完成这个

<?php
$url = "https://coinbase.com/";

$h = curl_init();
curl_setopt($h, CURLOPT_URL, $url);
curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($h, CURLOPT_HEADER, true);
curl_setopt($h, CURLOPT_RETURNTRANSFER, true);
curl_setopt($h, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($h, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($h, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($h, CURLOPT_POST, true);
curl_setopt($h, CURLOPT_POSTFIELDS, "utf8=%E2%9C%93&authenticity_token=".$csrf_token."&user%5Bemail%5D=example@outlook.com&user%5Bpassword%5D=examplepw&commit=Create+My+Account");

$result = curl_exec($h);

$tmp = preg_replace('!" name="csrf-token" />.*!s', '', $result);
$csrf_token = preg_replace('!.*"!s', '', $tmp);
print $csrf_token . "\n";
?>

最佳答案

有点不同的方法:

<?php
$url = "https://coinbase.com/";

$h = curl_init();
curl_setopt($h, CURLOPT_URL, $url);
curl_setopt($h, CURLOPT_SSL_VERIFYPEER, false);
#curl_setopt($h, CURLOPT_HEADER, true);
curl_setopt($h, CURLOPT_RETURNTRANSFER, true);
curl_setopt($h, CURLOPT_COOKIEJAR, 'cookies.txt');
curl_setopt($h, CURLOPT_COOKIEFILE, 'cookies.txt');
curl_setopt($h, CURLOPT_FOLLOWLOCATION, false);

$result = curl_exec($h);

$tmp = preg_replace('!" name="csrf-token" />.*!s', '', $result);
$csrf_token = preg_replace('!.*"!s', '', $tmp);
print $csrf_token . "\n";
?>

关于java - 加载curl php页面时如何获取java生成的元数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19082628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com