• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

phpcurlyoutube


PHP Snippet 1:

function http_get_contents($url)
{
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_TIMEOUT, 1);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  if (FALSE === ($retval = curl_exec($ch))) {
    echo curl_error($ch);
  } else {
    return $retval;
  }
}

$request_url = 'http://gdata.youtube.com/feeds/api/videos/SD3S27fMGzc';
$result = http_get_contents($request_url);

$simpleXML = new SimpleXMLElement($result);

print_r($simpleXML);

Related Snippets

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

Limit login attempts in Laravel 5.7

Clear javascript source cache laravel 5.8

I want a way to give path to my files which are outside of public folder in laravel

Composer fails with kylekatarnls/update-helper on new homestead

How can I get data from PHP to Android TextView?

Add rows to Single product Additional information table in WooCommerce 3.6

Best way to scrolldown onpageload

PHP: Telegram Bot: Insert line break to text message

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

Get all WooCommerce products within own plugin

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

Losing session data after POST from third party website

PHPS source file - 403 Forbidden You don't have permission to access this resource

find in set in laravel ? example

About Contact Privacy policy Terms and conditions