PHP: create POSTER like Firefox plugin - php

I would like to create a PHP application like FIREFOX "Poster" plug-in thisone
basically , I want to make a call to a url with post data, that will be the body of the URL.
(I want to send the contain of the body)

You're probably looking for curl.
Good luck with your project.

Related

Swagger: swagger.json interface

i tried to work with marketplace. They said that "Working with the API consists of sending a request and receiving a response. To do this, you can use the console to the right of the method descriptions, the Swagger interface"
Also, the link of "Swagger interface" => https://api-seller.ozon.ru/docs/#/
looks like this:
I`m a little bit confused, because i expected, that this is the library, or smth like this.
Link swagger.json
it`s a page with to json setting(as i think), picture is pretty view of plain text on that page:
so, i have no swagger library, but have this json.
Question:
Can i make from this json Swagger project?
When you click on swagger.json (as you shown in image with red arrow) it will redirect you to another page, this page have json configuration.
Copy this json and open https://editor.swagger.io/ this link, and paste your json.
After that, there is an option on menu 'Generate Client' it give you a various options to generate your client in Angular, C# and so on

How to scraping data using Simple HTML DOM Library and the target is ajax request

The url I want to scrape is https://www.tokopedia.com/juraganlim/info
and I just want to get the number of transaction like in this image (inside box is what I need to take):
I really am confused with ajax because I don't know the url which comes or goes.
When I inspect using Firefox it produces so many links.
Please anyone can give me a clue? Or directly the script?

php solution for parsing resulting html after ajax clicks

I'm currently using curl to login to a site and grab the html for one of the pages. My problem is that the page has some ajax links on it (click on the link results to html changes). How would I be able to make the clicks of the link and get the html of the final state using php? Seems like from researching this I need some sort of headless browser? Is there something like that in php I can use?
I'm not aware of any headless browsers that supports Javascript/AJAX that you can drive with PHP. If you want to drive a real browser with PHP, see http://seleniumhq.org/
Had this exact problem a few minutes ago. This works like a charm. Use .live() as the top answer here explains.
Reload javascript file after an AJAX request
Tested and works.

How to display data on another website via widget like facebook like box?

I have a RSS feed generated by my server ( for example : http://www.seek-team.com/en/teams/counter-strike-source/feed/ )
and I want the feed (only the title of the feed + article + links of course ;)) to be displayed on other website (other domains) as a widget like facebook like box or similar (i took facebook for example because it's very easy to set-up (copy, paste, that's all).
For a similar problem, i used JSON-P , but it's too difficult for the user to understand the jquery function to decode and display JSON-P than using a simple javascript inclusion.
What would you recommand ? Where would you start ?
Do you have any "how-to" to achieve this project with only one contraint : it must be installed via a javascript to avoid complexity
Thanks.
Then your best bet is to put your feed in to feedburner, then use something like the buzzBoost widget. It lets you control number of entries, the title of the whole widget, display the date, the author part of the content, none of the content, open in new window or same window etc.
example javascript to embed...
<script src="http://feeds.feedburner.com/blah?format=sigpro" type="text/javascript" ></script><noscript><p>Subscribe to RSS headline updates from: <br/>Powered by FeedBurner</p> </noscript>
Magpie (http://magpierss.sourceforge.net/) is a simple RSS feed reader for PHP that works well. From there, you could build simple code to encapsulate it into the "widget" format you're looking for.

how to create URL extractor like facebook share

i need to extract data from url
like title , description ,and any vedios images in the given url
like facebook share button
like this :
http://www.facebook.com/sharer.php?u=http://www.wired.com&t=Test
regards
Embed.ly has a nice api for exactly this purpose. Their api returns the site's oEmbed data if available - otherwise, it attempts to extract a summary of the page like Facebook.
Use something like cURL to get the page and then something like Simple HTML DOM to parse it and extract the elements you want.
If the web site has support for oEmbed, that's easier and more robust than scraping HTML:
oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly.
oEmbed is supported by sites like YouTube and Flickr.
I am working on a project for this issue, it is not as easy as writing an html parser and expecting sites to be 'semantical'. Especially extracting videos and finding auto-play parameters are killing. You can check the project in http://www.embedify.me, which has also fb-style url preview script. As I see, embed.ly and oembed are passive parser, they need the sites to support them, so called providers, the approach is quite different than fb does.
While I was looking for a similar functionality, I came across a jQuery + PHP demo of the url extract feature of Facebook messages:
http://www.99points.info/2010/07/facebook-like-extracting-url-data-with-jquery-ajax-php/
Instead of using an HTML DOM parser, it works with simple regular expressions. It looks for title, description and img tags. Hence, the image extraction doesn't perform well with a lot of websites, which use CSS for images. Also, Facebook looks first at its own meta tags and then at the classic description tag of HTML but it illustrates well the principe.

Categories