Curl和wget:为什么不使用GET参数? [英] Curl and wget: why isn't the GET parameter used?

查看:95
本文介绍了Curl和wget:为什么不使用GET参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PHP中的wget和curl从页中获取数据。如使用浏览器所见,默认结果是20个项目,但是通过将GET参数iip设置为数字x,我可以获取x个项目,即http:// www.example.com/ foo?a = 26033& b = 100

I am trying to fetch data from this page using wget and curl in PHP. As you can see by using your browser, the default result is 20 items but by setting the GET parameter iip to number x, I can fetch x items, i.e. http:// www.example.com/ foo ?a=26033&b=100

问题是iip参数仅在浏览器中有效。如果我尝试使用wget或curl获取最后一个链接,则仅返回20个项目。为什么?在命令行上尝试以下操作:

The problem is that the iip parameter only works in browsers. If I try to fetch the last link using wget or curl, only 20 items are returned. Why? Try this at the command-line:

curl -O http://www.example.com/foo?a=26033&iip=b
wget http://www.example.com/foo?a=26033&iip=b

为什么不能使用GET参数iip?

Why can't I use the GET parameter iip?

推荐答案

尝试添加引号:

curl -O 'http://www.objektvision.se/annonsorer?ai=26033&iip=100'
wget 'http://www.objektvision.se/annonsorer?ai=26033&iip=100'

& 在命令行上具有特殊功能,这很可能会引起问题。

The & has special functionality on the command line which is likely causing the issues.

这篇关于Curl和wget:为什么不使用GET参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆