Click here to Skip to main content
15,610,223 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
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 ?
Posted
Updated 18-Dec-22 11:08am
v2
Comments
Sergey Alexandrovich Kryukov 19-Sep-14 15:52pm    
It all depends on: paste where? From where? If from PHP, do you mean its use as a server-side script language, or local application? Why? And why not some desktop application? But then, what language would you prefer to use?
—SA

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900