Solved

$_GET call between URL

Posted on 2017-04-04
3
37 Views
Last Modified: 2017-04-04
<?php
if( $_GET["shortcode"]) {
$api = file_get_contents("https://api.instagram.com/oembed/?url=http://instagram.com/p/"$_GET["shortcode"]"/");      
$apiObj = json_decode($api,true);      
$media_id = $apiObj['media_id'];
echo $_GET["shortcode"];
}

Open in new window


it not work . how can i call $_GET between URL
http://instagram.com/p/"$_GET["shortcode"]"/");

Open in new window

0
Comment
Question by:Mehran Goudarzi
3 Comments
 
LVL 7

Expert Comment

by:Leonidas Dosas
ID: 42077653
Try with isset function:

if(isset( $_GET["shortcode"])){
//code here...
}

Open in new window

0
 
LVL 4

Accepted Solution

by:
Peos John earned 500 total points
ID: 42077660
You need to add dot(.) to concat the string, Please check the below line.

$api = file_get_contents("https://api.instagram.com/oembed/?url=http://instagram.com/p/".$_GET["shortcode"]."/");      

Open in new window

1
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 42077898
If you're new to PHP and want some good learning resources, this article can help.
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question