使用javascript或php自动发布广告 [英] Post an ad automatically using javascript or php

查看:59
本文介绍了使用javascript或php自动发布广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hy人。



我想自动发布广告。



我的第一个想法是使用iframe并使用javascript(jquery)来完成表单。自动。只需将分类广告网站中的网址放入,然后使用jquery插入textarea并输入filelds数据库中的值。



现在最大的问题是分类 - site-example [dot] com不允许iframe访问他们的网站。像谷歌一样(阅读更多详情:stackoverflow [dot] com / questions / 8700636 / how-to-show-google-com-in-an-iframe)。



对我来说有什么解决方案吗?

解决方案

请看我对这个问题的评论:你不清楚为什么要尝试解决这个问题。



让我们专注于使用Javascript发送请求,拥有一个本地HTML页面(根本没有服务器端;或者更确切地说,服务器端无关紧要)。你所有的框架和其他东西是完全无关紧要的。 提交只是意味着您只需要发送适当的HTTP请求。使用Java,它是使用Ajax完成的,最方便的方法是使用jQuery .Ajax()

http://en.wikipedia.org/wiki/Ajax_(编程) [ ^ ],

http://api.jquery.com/jquery.ajax [ ^ ]。



更严重的问题是:如何知道究竟要发送什么,以什么形式发送?首先,从您的问题来看,我可以假设您有一些手动,非自动方式发布广告,最有可能在支持这些广告的网站上(其他地方?)。因此,了解此提交页面的作用。它也可以使用Ajax或仅使用HTML表单来完成。您需要查看该HTML页面的源代码,也可以下载相关脚本,看看它的作用。



但我有一个不同的想法:你可以跳过所有中间步骤(获取和转换数据,无论它是什么,等等)并直接获取HTTP请求。为此,请下载并使用其中一个可用的HTTP间谍应用程序。通常,此类应用程序实现为某些现有浏览器的插件。例如,我使用HttpFox,一个Mozilla浏览器的插件,但你可以使用其他任何东西。在浏览器中激活此类应用程序(开始跟踪HTTP包),然后执行手动提交。完成所有操作后,查看所有已发送的HTTP请求并接收HTTP响应。了解发送的内容;尝试一下不同的提交来捕捉模式。在您自己的Javascript中完全相同。即使在相当棘手的情况下,这种简单的技术几乎总能帮助我做一些 Web抓取



-SA

Hy people.

I want to post an ad automatically.

My first idea was to use an iframe and using javascript (jquery) to complete the form. Automatically. Just putting the url from the classifieds site and then, with jquery, insert into textarea and input filelds my values from database.

The big problem now is that "classified-site-example[dot]com" doesn't permit iframes to their website. Like google ( read more details: stackoverflow[dot]com/questions/8700636/how-to-show-google-com-in-an-iframe ).

Any solution for me, please ?

解决方案

Please see my comment to the question: it's not clear why would you try to approach the problem like that.

Let's concentrate on having a local HTML page (no server side at all; or, more exactly, having server side is irrelevant) with Javascript sending the request. All you frames and other things are totally irrelevant. The "submission" simply means that you merely should send appropriate HTTP request. With Java, it is done using Ajax, and the most convenient way of doing so would be using jQuery .Ajax():
http://en.wikipedia.org/wiki/Ajax_(programming)[^],
http://api.jquery.com/jquery.ajax[^].

More serious problem is: how to know what exactly to send, in what form? First of all, from your question, I can assume that you have some "manual", "non-automatic" way of posting the ad, most likely on the site supporting those ads (where else?). So, learn what this submit page does. It can also do it using Ajax, or using just the HTML form. You need to see at the source code of that HTML page, perhaps also download relevant scripts, and see what it does.

But I have a different idea: you can skip all the intermediate steps (getting and transforming data, whatever it is, an so on) and get directly to the HTTP request. For that purpose, download and use one of the available HTTP spy applications. Typically, such applications are implemented as plug-ins for some existing browser. I, for example, use HttpFox, a plug-in for the Mozilla browsers, but you can use anything else. Activate such application in the browser (start tracking HTTP packages) and then perform manual submission. When it all done, look at all the sent HTTP requests and received HTTP responses. Understand what is sent; experiment a bit with different submissions to catch the pattern. Do exactly the same in your own Javascript. This simple technique nearly always helped me to do some Web scraping even in pretty tricky situations.

—SA


这篇关于使用javascript或php自动发布广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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