Search Results
… to the function. The following example reads a web page using the PHP CURL functions and then passes the result into the function to retrieve the links. $url = 'http://www.hashbangcode.com'; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); …
Article: Shortening Long URLs With PHP
… Print out a full URL for a link will sometimes mess up your formatting, especially if you URL is quite long. This might be the case if you are linking to a Google search page, or have an automated script that shows numerous URLs of indeterminate length. The following function will reduce any …
Article: Capture A Website As Image With PHP
… the Thumbshots website. <img src="http://open.thumbshots.org/image.pxf?url=http%3A%2F%2Fwww.hashbangcode.com%2F" alt="Site image" /> Websnapr … for a small image of #! code. <img src="http://images.websnapr.com/?url=http%3A%2F%2Fwww.hashbangcode.com%2F&size=s" alt="Site image" /> … in pixels. sdy : The height of the rendering browser in pixels. url : The URL that the image is to be created from. So putting these …
Article: Preparing A URL With PHP
… be many instances where you will create a program in PHP that takes a URL as input and does something with the address. This might be a site … an image resize, but whatever the use is, you need to be sure that the URL will work or at least has the same format. What users tend to leave out of a URL string is the http:// bit at the start. You could validate the URL …
Article: Fibers In PHP 8.1
… of a web page we could do something like this. function get_web_page($url) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, …
Article: Timing Page Responses With Curl
… Timing web requests is possible in curl using the -w or --write-out flag. This flag takes a number of … getting feedback on the response. The -w or --write-out flag in curl has a number of different options, far more than I can add here. … just the HTTP status code of the response we would use the following curl command. curl -w "%{http_code}" -o /dev/null -sL …
Article: PHP IP To Location
… we can do with this is to encapsulate the iplocation class and make a URL to location converter. This essentially just converts the URL into an IP address and then creates an IpLocation_Ip object to do the lookup. class IpLocation_Url { /** * @var string The last IP address converted. */ public …
… share content through the use of an API. This allows users to share a URL for a web page and see a representation of that page embedded in … the providers.json registry. { "provider_name": "Twitter", "provider_url": "http://www.twitter.com/", "endpoints": [ { "schemes": [ … "https://*.twitter.com/*/status/*" ], "url": "https://publish.twitter.com/oembed" } ] } Using this information …
… pointing to a page, and this can be created easily using a Drupal\Core\Url object. $url = Url::fromRoute('entity.node.canonical', ['node' => 1]); return new …
… location then you would use drupal_realpath(), whereas if you want a URL of the file you would use file_create_url(). For example, the a file called test.png in the public file … , this would be translated in the following ways by the file_create_url() and drupal_realpath() functions. $url = …